home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / othergnu / termca~1.zoo / texinfo.tex < prev    next >
Encoding:
Text File  |  1992-04-02  |  102.9 KB  |  3,264 lines

  1. %% TeX macros to handle texinfo files
  2.  
  3. %   Copyright (C) 1985, 1986, 1988, 1990, 1991 Free Software Foundation, Inc.
  4.  
  5. %This texinfo.tex file is free software; you can redistribute it and/or
  6. %modify it under the terms of the GNU General Public License as
  7. %published by the Free Software Foundation; either version 2, or (at
  8. %your option) any later version.
  9.  
  10. %This texinfo.tex file is distributed in the hope that it will be
  11. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  12. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. %General Public License for more details.
  14.  
  15. %You should have received a copy of the GNU General Public License
  16. %along with this texinfo.tex file; see the file COPYING.  If not, write
  17. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  18. %USA.
  19.  
  20.  
  21. %In other words, you are welcome to use, share and improve this program.
  22. %You are forbidden to forbid anyone else to use, share and improve
  23. %what you give them.   Help stamp out software-hoarding!
  24.  
  25. \def\texinfoversion{2.68}
  26. \message{Loading texinfo package [Version \texinfoversion]:}
  27. \message{}
  28.  
  29. % Print the version number if in a .fmt file.
  30. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  31.  
  32. % Save some parts of plain tex whose names we will redefine.
  33.  
  34. \let\ptexlbrace=\{
  35. \let\ptexrbrace=\}
  36. \let\ptexdots=\dots
  37. \let\ptexdot=\.
  38. \let\ptexstar=\*
  39. \let\ptexend=\end
  40. \let\ptexbullet=\bullet
  41. \let\ptexb=\b
  42. \let\ptexc=\c
  43. \let\ptexi=\i
  44. \let\ptext=\t
  45. \let\ptexl=\l
  46. \let\ptexL=\L
  47.  
  48. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  49.  
  50. \message{Basics,}
  51. \chardef\other=12
  52.  
  53. \hyphenation{ap-pen-dix}
  54. \hyphenation{mini-buf-fer mini-buf-fers}
  55. \hyphenation{eshell}
  56.  
  57. % Margin to add to right of even pages, to left of odd pages.
  58. \newdimen \bindingoffset  \bindingoffset=0pt
  59. \newdimen \normaloffset   \normaloffset=\hoffset
  60. \newdimen\pagewidth \newdimen\pageheight
  61. \pagewidth=\hsize \pageheight=\vsize
  62.  
  63. % Sometimes it is convenient to have everything in the transcript file
  64. % and nothing on the terminal.  We don't just call \tracingall here,
  65. % since that produces some useless output on the terminal.
  66. %
  67. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  68. \def\loggingall{\tracingcommands2 \tracingstats2 
  69.    \tracingpages1 \tracingoutput1 \tracinglostchars1 
  70.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1 
  71.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  72. }%
  73.  
  74. %---------------------Begin change-----------------------
  75. %
  76. %%%% For @cropmarks command.
  77. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  78. %
  79. \newdimen\cornerlong \newdimen\cornerthick
  80. \newdimen \topandbottommargin
  81. \newdimen \outerhsize \newdimen \outervsize
  82. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  83. \outerhsize=7in
  84. %\outervsize=9.5in
  85. % Alternative @smallbook page size is 9.25in
  86. \outervsize=9.25in
  87. \topandbottommargin=.75in
  88. %
  89. %---------------------End change-----------------------
  90.  
  91. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  92. % does insertions itself, but you have to call it yourself.
  93. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  94. \def\onepageout#1{\hoffset=\normaloffset
  95. \ifodd\pageno  \advance\hoffset by \bindingoffset
  96. \else \advance\hoffset by -\bindingoffset\fi
  97. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  98. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  99. {\let\hsize=\pagewidth \makefootline}}}%
  100. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  101.  
  102. %%%% For @cropmarks command %%%%
  103.  
  104. % Here is a modification of the main output routine for Near East Publications
  105. % This provides right-angle cropmarks at all four corners.
  106. % The contents of the page are centerlined into the cropmarks,
  107. % and any desired binding offset is added as an \hskip on either
  108. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  109. %
  110. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  111.          \shipout
  112.          \vbox to \outervsize{\hsize=\outerhsize
  113.                  \vbox{\line{\ewtop\hfill\ewtop}}
  114.                  \nointerlineskip
  115.                  \line{\vbox{\moveleft\cornerthick\nstop}
  116.                        \hfill
  117.                        \vbox{\moveright\cornerthick\nstop}}
  118.                  \vskip \topandbottommargin
  119.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  120.             \vbox{
  121.             {\let\hsize=\pagewidth \makeheadline}
  122.             \pagebody{#1}
  123.             {\let\hsize=\pagewidth \makefootline}}
  124.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  125.          \vskip \topandbottommargin plus1fill minus1fill
  126.                  \boxmaxdepth\cornerthick
  127.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  128.                        \hfill
  129.                        \vbox{\moveright\cornerthick\nsbot}}
  130.                  \nointerlineskip
  131.                  \vbox{\line{\ewbot\hfill\ewbot}}
  132.     }
  133.   \advancepageno 
  134.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  135. %
  136. % Do @cropmarks to get crop marks
  137. \def\cropmarks{\let\onepageout=\croppageout }
  138.  
  139. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  140. {\catcode`\@ =11
  141. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  142. \dimen@=\dp#1 \unvbox#1
  143. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  144. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  145. }
  146.  
  147. %
  148. % Here are the rules for the cropmarks.  Note that they are
  149. % offset so that the space between them is truly \outerhsize or \outervsize
  150. % (P. A. MacKay, 12 November, 1986)
  151. %
  152. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  153. \def\nstop{\vbox
  154.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  155. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  156. \def\nsbot{\vbox
  157.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  158.  
  159. % Parse an argument, then pass it to #1.
  160. % The argument can be delimited with [...] or with "..." or braces
  161. % or it can be a whole line.
  162. % #1 should be a macro which expects
  163. % an ordinary undelimited TeX argument.
  164.  
  165. \def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
  166.  
  167. \def\parseargx{%
  168. \ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
  169. \aftergroup \parseargline %
  170. \fi \endgroup}
  171.  
  172. {\obeyspaces %
  173. \gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
  174.  
  175. \gdef\obeyedspace{\ }
  176.  
  177. \def\parseargline{\begingroup \obeylines \parsearglinex}
  178. {\obeylines %
  179. \gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
  180.  
  181. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  182.  
  183. %% These are used to keep @begin/@end levels from running away
  184. %% Call \inENV within environments (after a \begingroup)
  185. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  186. \def\ENVcheck{%
  187. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  188. \endgroup\fi} % This is not perfect, but it should reduce lossage
  189.  
  190. % @begin foo  is the same as @foo, for now.
  191. \newhelp\EMsimple{Type <Return> to continue}
  192.  
  193. \outer\def\begin{\parsearg\beginxxx}
  194.  
  195. \def\beginxxx #1{%
  196. \expandafter\ifx\csname #1\endcsname\relax
  197. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  198. \csname #1\endcsname\fi}
  199.  
  200. %% @end foo executes the definition of \Efoo.
  201. %% foo can be delimited by doublequotes or brackets.
  202.  
  203. \def\end{\parsearg\endxxx}
  204.  
  205. \def\endxxx #1{%
  206. \expandafter\ifx\csname E#1\endcsname\relax
  207. \expandafter\ifx\csname #1\endcsname\relax
  208. \errmessage{Undefined command @end #1}\else
  209. \errorE{#1}\fi\fi
  210. \csname E#1\endcsname}
  211. \def\errorE#1{
  212. {\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
  213.  
  214. % Single-spacing is done by various environments.
  215.  
  216. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  217. \def\singlespace{%
  218. {\advance \baselineskip by -\singlespaceskip
  219. \kern \baselineskip}%
  220. \baselineskip=\singlespaceskip
  221. }
  222.  
  223. %% Simple single-character @ commands
  224.  
  225. % @@ prints an @
  226. % Kludge this until the fonts are right (grr).
  227. \def\@{{\tt \char '100}}
  228.  
  229. % Define @` and @' to be the same as ` and '
  230. % but suppressing ligatures.
  231. \def\`{{`}}
  232. \def\'{{'}}
  233.  
  234. % Used to generate quoted braces.
  235.  
  236. \def\mylbrace {{\tt \char '173}}
  237. \def\myrbrace {{\tt \char '175}}
  238. \let\{=\mylbrace
  239. \let\}=\myrbrace
  240.  
  241. % @: forces normal size whitespace following.
  242. \def\:{\spacefactor=1000 }
  243.  
  244. % @* forces a line break.
  245. \def\*{\hfil\break\hbox{}\ignorespaces}
  246.  
  247. % @. is an end-of-sentence period.
  248. \def\.{.\spacefactor=3000 }
  249.  
  250. % @w prevents a word break
  251. \def\w #1{\hbox{#1}}
  252.  
  253. % @group ... @end group  forces ... to be all on one page.
  254.  
  255. \def\group{\begingroup% \inENV ???
  256. \ifnum\catcode13=\active \else
  257. \errmessage{@group invalid in context where filling is enabled}\fi
  258. \def \Egroup{\egroup\endgroup}
  259. \vbox\bgroup}
  260.  
  261. % @need space-in-mils
  262. % forces a page break if there is not space-in-mils remaining.
  263.  
  264. \newdimen\mil  \mil=0.001in
  265.  
  266. \def\need{\parsearg\needx}
  267.  
  268. \def\needx #1{\par %
  269. % This method tries to make TeX break the page naturally
  270. % if the depth of the box does not fit.
  271. {\baselineskip=0pt%
  272. \vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  273. \prevdepth=-1000pt
  274. }}
  275.  
  276. % @br   forces paragraph break
  277.  
  278. \let\br = \par
  279.  
  280. % @dots{}  output some dots
  281.  
  282. \def\dots{$\ldots$}
  283.  
  284. % @page    forces the start of a new page
  285.  
  286. \def\page{\par\vfill\supereject}
  287.  
  288. % @exdent text....
  289. % outputs text on separate line in roman font, starting at standard page margin
  290.  
  291. \def\exdent{\errmessage{@exdent in filled text}}
  292.   % @lisp, etc, define \exdent locally from \internalexdent
  293.  
  294. {\obeyspaces
  295. \gdef\internalexdent{\parsearg\exdentzzz}}
  296.  
  297. \def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
  298. \advance \hsize by -\leftskip
  299. \advance \hsize by -\rightskip
  300. \leftline{{\rm#1}}}}
  301.  
  302. % @include file    insert text of that file as input.
  303.  
  304. \def\include{\parsearg\includezzz}
  305. \def\includezzz #1{{\def\thisfile{#1}\input #1
  306. }}
  307.  
  308. \def\thisfile{}
  309.  
  310. % @center line   outputs that line, centered
  311.  
  312. \def\center{\parsearg\centerzzz}
  313. \def\centerzzz #1{{\advance\hsize by -\leftskip
  314. \advance\hsize by -\rightskip
  315. \centerline{#1}}}
  316.  
  317. % @sp n   outputs n lines of vertical space
  318.  
  319. \def\sp{\parsearg\spxxx}
  320. \def\spxxx #1{\par \vskip #1\baselineskip}
  321.  
  322. % @comment ...line which is ignored...
  323. % @c is the same as @comment
  324. % @ignore ... @end ignore  is another way to write a comment
  325.  
  326. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  327. \parsearg \commentxxx}
  328.  
  329. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  330.  
  331. \let\c=\comment
  332.  
  333. % Prevent errors for section commands.
  334. % Used in @ignore and in failing conditionals.
  335. \def\ignoresections{%
  336. \let\chapter=\relax
  337. \let\unnumbered=\relax
  338. \let\top=\relax
  339. \let\unnumberedsec=\relax
  340. \let\unnumberedsection=\relax
  341. \let\unnumberedsubsec=\relax
  342. \let\unnumberedsubsection=\relax
  343. \let\unnumberedsubsubsec=\relax
  344. \let\unnumberedsubsubsection=\relax
  345. \let\section=\relax
  346. \let\subsec=\relax
  347. \let\subsubsec=\relax
  348. \let\subsection=\relax
  349. \let\subsubsection=\relax
  350. \let\appendix=\relax
  351. \let\appendixsec=\relax
  352. \let\appendixsection=\relax
  353. \let\appendixsubsec=\relax
  354. \let\appendixsubsection=\relax
  355. \let\appendixsubsubsec=\relax
  356. \let\appendixsubsubsection=\relax
  357. \let\contents=\relax
  358. \let\smallbook=\relax
  359. \let\titlepage=\relax
  360. }
  361.  
  362. \def\ignore{\begingroup\ignoresections
  363. % Make sure that spaces turn into tokens that match what \ignorexxx wants.
  364. \catcode32=10
  365. \ignorexxx}
  366. \long\def\ignorexxx #1\end ignore{\endgroup\ignorespaces}
  367.  
  368. \def\direntry{\begingroup\direntryxxx}
  369. \long\def\direntryxxx #1\end direntry{\endgroup\ignorespaces}
  370.  
  371. % Conditionals to test whether a flag is set.
  372.  
  373. \def\ifset{\begingroup\ignoresections\parsearg\ifsetxxx}
  374.  
  375. \def\ifsetxxx #1{\endgroup
  376. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\ifsetfail
  377. \else \let\temp=\relax \fi
  378. \temp}
  379. \def\Eifset{}
  380. \def\ifsetfail{\begingroup\ignoresections\ifsetfailxxx}
  381. \long\def\ifsetfailxxx #1\end ifset{\endgroup\ignorespaces}
  382.  
  383. \def\ifclear{\begingroup\ignoresections\parsearg\ifclearxxx}
  384.  
  385. \def\ifclearxxx #1{\endgroup
  386. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\relax
  387. \else \let\temp=\ifclearfail \fi
  388. \temp}
  389. \def\Eifclear{}
  390. \def\ifclearfail{\begingroup\ignoresections\ifclearfailxxx}
  391. \long\def\ifclearfailxxx #1\end ifclear{\endgroup\ignorespaces}
  392.  
  393. % @set foo     to set the flag named foo.
  394. % @clear foo   to clear the flag named foo.
  395. \def\set{\parsearg\setxxx}
  396. \def\setxxx #1{
  397. \expandafter\let\csname IF#1\endcsname=\set}
  398.  
  399. \def\clear{\parsearg\clearxxx}
  400. \def\clearxxx #1{
  401. \expandafter\let\csname IF#1\endcsname=\relax}
  402.  
  403. % Some texinfo constructs that are trivial in tex
  404.  
  405. \def\iftex{}
  406. \def\Eiftex{}
  407. \def\ifinfo{\begingroup\ignoresections\ifinfoxxx}
  408. \long\def\ifinfoxxx #1\end ifinfo{\endgroup\ignorespaces}
  409.  
  410. \long\def\menu #1\end menu{}
  411. \def\asis#1{#1}
  412.  
  413. % @math means output in math mode.
  414. % We don't use $'s directly in the definition of \math because control
  415. % sequences like \math are expanded when the toc file is written.  Then,
  416. % we read the toc file back, the $'s will be normal characters (as they
  417. % should be, according to the definition of Texinfo).  So we must use a
  418. % control sequence to switch into and out of math mode.
  419. % This isn't quite enough for @math to work properly in indices, but it
  420. % seems unlikely it will ever be needed there.
  421. \let\implicitmath = $
  422. \def\math#1{\implicitmath #1\implicitmath}
  423.  
  424. \def\node{\ENVcheck\parsearg\nodezzz}
  425. \def\nodezzz#1{\nodexxx [#1,]}
  426. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  427. \let\lastnode=\relax
  428.  
  429. \def\donoderef{\ifx\lastnode\relax\else
  430. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  431. \let\lastnode=\relax}
  432.  
  433. \def\unnumbnoderef{\ifx\lastnode\relax\else
  434. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  435. \let\lastnode=\relax}
  436.  
  437. \def\appendixnoderef{\ifx\lastnode\relax\else
  438. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  439. \let\lastnode=\relax}
  440.  
  441. \let\refill=\relax
  442.   
  443. % @setfilename is done at the beginning of every texinfo file.
  444. % So open here the files we need to have open while reading the input.
  445. % This makes it possible to make a .fmt file for texinfo.
  446. \def\setfilename{%
  447.    \readauxfile
  448.    \opencontents
  449.    \openindices
  450.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  451.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  452.    \comment % Ignore the actual filename.
  453. }
  454.  
  455. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  456.  
  457. \def\inforef #1{\inforefzzz #1,,,,**}
  458. \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}},
  459.   node \samp{\losespace#1{}}}
  460. \def\losespace #1{#1}
  461.  
  462. \message{fonts,}
  463.  
  464. % Font-change commands.
  465.  
  466. % Texinfo supports the sans serif font style, which plain TeX does not.
  467. % So we set up a \sf analogous to plain's \rm, etc.
  468. \newfam\sffam
  469. \def\sf{\fam=\sffam \tensf}
  470. \let\li = \sf % Sometimes we call it \li, not \sf.
  471.  
  472. %% Try out Computer Modern fonts at \magstephalf
  473. \let\mainmagstep=\magstephalf
  474.  
  475. \ifx\bigger\relax
  476. \let\mainmagstep=\magstep1
  477. \font\textrm=cmr12
  478. \font\texttt=cmtt12
  479. \else
  480. \font\textrm=cmr10 scaled \mainmagstep
  481. \font\texttt=cmtt10 scaled \mainmagstep
  482. \fi
  483. % Instead of cmb10, you many want to use cmbx10.
  484. % cmbx10 is a prettier font on its own, but cmb10
  485. % looks better when embedded in a line with cmr10.
  486. \font\textbf=cmb10 scaled \mainmagstep 
  487. \font\textit=cmti10 scaled \mainmagstep
  488. \font\textsl=cmsl10 scaled \mainmagstep
  489. \font\textsf=cmss10 scaled \mainmagstep
  490. \font\textsc=cmcsc10 scaled \mainmagstep
  491. \font\texti=cmmi10 scaled \mainmagstep
  492. \font\textsy=cmsy10 scaled \mainmagstep
  493.  
  494. % A few fonts for @defun, etc.
  495. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  496. \font\deftt=cmtt10 scaled \magstep1
  497. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  498.  
  499. % Fonts for indices and small examples.
  500. % We actually use the slanted font rather than the italic, 
  501. % because texinfo normally uses the slanted fonts for that.
  502. % Do not make many font distinctions in general in the index, since they
  503. % aren't very useful.
  504. \font\ninett=cmtt9
  505. \font\indrm=cmr9
  506. \font\indit=cmsl9
  507. \let\indsl=\indit
  508. \let\indtt=\ninett
  509. \let\indsf=\indrm
  510. \let\indbf=\indrm
  511. \let\indsc=\indrm
  512. \font\indi=cmmi9
  513. \font\indsy=cmsy9
  514.  
  515. % Fonts for headings
  516. \font\chaprm=cmbx12 scaled \magstep2
  517. \font\chapit=cmti12 scaled \magstep2
  518. \font\chapsl=cmsl12 scaled \magstep2
  519. \font\chaptt=cmtt12 scaled \magstep2
  520. \font\chapsf=cmss12 scaled \magstep2
  521. \let\chapbf=\chaprm
  522. \font\chapsc=cmcsc10 scaled\magstep3
  523. \font\chapi=cmmi12 scaled \magstep2
  524. \font\chapsy=cmsy10 scaled \magstep3
  525.  
  526. \font\secrm=cmbx12 scaled \magstep1
  527. \font\secit=cmti12 scaled \magstep1
  528. \font\secsl=cmsl12 scaled \magstep1
  529. \font\sectt=cmtt12 scaled \magstep1
  530. \font\secsf=cmss12 scaled \magstep1
  531. \font\secbf=cmbx12 scaled \magstep1
  532. \font\secsc=cmcsc10 scaled\magstep2
  533. \font\seci=cmmi12 scaled \magstep1
  534. \font\secsy=cmsy10 scaled \magstep2
  535.  
  536. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  537. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  538. % \font\ssecsl=cmsl10 scaled \magstep1
  539. % \font\ssectt=cmtt10 scaled \magstep1
  540. % \font\ssecsf=cmss10 scaled \magstep1
  541.  
  542. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  543. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  544. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  545. %\font\ssectt=cmtt10 scaled 1315
  546. %\font\ssecsf=cmss10 scaled 1315
  547.  
  548. %\let\ssecbf=\ssecrm
  549.  
  550. \font\ssecrm=cmbx12 scaled \magstephalf
  551. \font\ssecit=cmti12 scaled \magstephalf
  552. \font\ssecsl=cmsl12 scaled \magstephalf
  553. \font\ssectt=cmtt12 scaled \magstephalf
  554. \font\ssecsf=cmss12 scaled \magstephalf
  555. \font\ssecbf=cmbx12 scaled \magstephalf
  556. \font\ssecsc=cmcsc10 scaled \magstep1 
  557. \font\sseci=cmmi12 scaled \magstephalf
  558. \font\ssecsy=cmsy10 scaled \magstep1
  559. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  560. % but that is not a standard magnification.
  561.  
  562. % Fonts for title page:
  563. \font\titlerm = cmbx12 scaled \magstep3
  564. \let\authorrm = \secrm
  565.  
  566. % In order for the font changes to affect most math symbols and letters,
  567. % we have to define the \textfont of the standard families.  Since
  568. % texinfo doesn't allow for producing subscripts and superscripts, we
  569. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  570. % also require loading a lot more fonts).
  571. \def\resetmathfonts{%
  572.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  573.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  574.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  575. }
  576.  
  577.  
  578. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  579. % of just \STYLE.  We do this so that font changes will continue to work
  580. % in math mode, where it is the current \fam that is relevant in most
  581. % cases, not the current.  Plain TeX does, for example,
  582. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  583. % to redefine \bf itself.  
  584. \def\textfonts{%
  585.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  586.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  587.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  588.   \resetmathfonts}
  589. \def\chapfonts{%
  590.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 
  591.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  592.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  593.   \resetmathfonts}
  594. \def\secfonts{%
  595.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  596.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  597.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  598.   \resetmathfonts}
  599. \def\subsecfonts{%
  600.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  601.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  602.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  603.   \resetmathfonts}
  604. \def\indexfonts{%
  605.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  606.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  607.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  608.   \resetmathfonts}
  609.  
  610. % Set up the default fonts, so we can use them for creating boxes.
  611. \textfonts
  612.  
  613. % Count depth in font-changes, for error checks
  614. \newcount\fontdepth \fontdepth=0
  615.  
  616. % Fonts for short table of contents.
  617. \font\shortcontrm=cmr12
  618. \font\shortcontbf=cmbx12
  619. \font\shortcontsl=cmsl12
  620.  
  621. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  622. %% serif) and @ii for TeX italic
  623.  
  624. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  625. % unless the following character is such as not to need one.
  626. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  627. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  628.  
  629. \let\i=\smartitalic
  630. \let\var=\smartitalic
  631. \let\dfn=\smartitalic
  632. \let\emph=\smartitalic
  633. \let\cite=\smartitalic
  634.  
  635. \def\b#1{{\bf #1}}
  636. \let\strong=\b
  637.  
  638. \def\t#1{{\tt \exhyphenpenalty=10000\rawbackslash \frenchspacing #1}\null}
  639. \let\ttfont = \t
  640. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  641. \def\samp #1{`\tclose{#1}'\null}
  642. \def\key #1{{\tt \exhyphenpenalty=10000\uppercase{#1}}\null}
  643. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  644.  
  645. \let\file=\samp
  646.  
  647. % @code is a modification of @t,
  648. % which makes spaces the same size as normal in the surrounding text.
  649. \newdimen\tclosesave
  650. \newdimen\tcloserm
  651. \def\tclose#1{{\rm \tcloserm=\fontdimen2\font \tt \tclosesave=\fontdimen2\font
  652. \fontdimen2\font=\tcloserm
  653. % prevent breaking lines at hyphens.
  654. \exhyphenpenalty=10000
  655. \def\ {{\fontdimen2\font=\tclosesave{} }}%
  656.  \rawbackslash \frenchspacing #1\fontdimen2\font=\tclosesave}\null}
  657. \let\code=\tclose
  658. %\let\exp=\tclose  %Was temporary
  659.  
  660. % @kbd is like @code, except that if the argument is just one @key command, 
  661. % then @kbd has no effect.
  662.  
  663. \def\xkey{\key}
  664. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  665. \ifx\one\xkey\ifx\threex\three \key{#2}%
  666. \else\tclose{\look}\fi
  667. \else\tclose{\look}\fi}
  668.  
  669. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  670. % argument is to make the input look right: @dmn{pt} instead of
  671. % @dmn{}pt.
  672. \def\dmn#1{\thinspace #1}
  673.  
  674. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  675.  
  676. \def\l#1{{\li #1}\null}        % 
  677.  
  678. \def\r#1{{\rm #1}}        % roman font
  679. % Use of \lowercase was suggested.
  680. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  681. \def\ii#1{{\it #1}}        % italic font
  682.  
  683. \message{page headings,}
  684.  
  685. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  686. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  687.  
  688. % First the title page.  Must do @settitle before @titlepage.
  689. \def\titlefont#1{{\titlerm #1}}
  690.  
  691. \newtoks\realeverypar
  692. \newif\ifseenauthor
  693. \newif\iffinishedtitlepage
  694.  
  695. \def\titlepage{\begingroup \parindent=0pt \textfonts
  696.    \let\subtitlerm=\tenrm
  697. % I deinstalled the following change because \cmr12 is undefined.
  698. % This change was not in the ChangeLog anyway.  --rms.
  699. %   \let\subtitlerm=\cmr12
  700.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  701.    %
  702.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  703.    %
  704.    % Leave some space at the very top of the page.
  705.    \vglue\titlepagetopglue
  706.    %
  707.    % Now you can print the title using @title.
  708.    \def\title{\parsearg\titlezzz}%
  709.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  710.             % print a rule at the page bottom also.
  711.             \finishedtitlepagefalse
  712.             \vskip4pt \hrule height 4pt \vskip4pt}%
  713.    % No rule at page bottom unless we print one at the top with @title.
  714.    \finishedtitlepagetrue
  715.    %
  716.    % Now you can put text using @subtitle.
  717.    \def\subtitle{\parsearg\subtitlezzz}%
  718.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  719.    %
  720.    % @author should come last, but may come many times.
  721.    \def\author{\parsearg\authorzzz}%
  722.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  723.       {\authorfont \leftline{##1}}}%
  724.    %  
  725.    % Most title ``pages'' are actually two pages long, with space
  726.    % at the top of the second.  We don't want the ragged left on the second.
  727.    \let\oldpage = \page
  728.    \def\page{%
  729.       \iffinishedtitlepage\else
  730.      \finishtitlepage
  731.       \fi
  732.       \oldpage
  733.       \let\page = \oldpage
  734.       \hbox{}}%
  735. %   \def\page{\oldpage \hbox{}}
  736. }
  737.  
  738. \def\Etitlepage{%
  739.    \iffinishedtitlepage\else
  740.       \finishtitlepage
  741.    \fi
  742.    % It is important to do the page break before ending the group,
  743.    % because the headline and footline are only empty inside the group.
  744.    % If we use the new definition of \page, we always get a blank page
  745.    % after the title page, which we certainly don't want.
  746.    \oldpage
  747.    \endgroup
  748.    \HEADINGSon
  749. }
  750.  
  751. \def\finishtitlepage{%
  752.    \vskip4pt \hrule height 2pt
  753.    \vskip\titlepagebottomglue
  754.    \finishedtitlepagetrue
  755. }
  756.  
  757. %%% Set up page headings and footings.
  758.  
  759. \let\thispage=\folio
  760.  
  761. \newtoks \evenheadline    % Token sequence for heading line of even pages
  762. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  763. \newtoks \evenfootline    % Token sequence for footing line of even pages
  764. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  765.  
  766. % Now make Tex use those variables
  767. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  768.                             \else \the\evenheadline \fi}}
  769. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  770.                             \else \the\evenfootline \fi}\HEADINGShook}
  771. \let\HEADINGShook=\relax
  772.  
  773. % Commands to set those variables.
  774. % For example, this is what  @headings on  does
  775. % @evenheading @thistitle|@thispage|@thischapter
  776. % @oddheading @thischapter|@thispage|@thistitle
  777. % @evenfooting @thisfile||
  778. % @oddfooting ||@thisfile
  779.  
  780. \def\evenheading{\parsearg\evenheadingxxx}
  781. \def\oddheading{\parsearg\oddheadingxxx}
  782. \def\everyheading{\parsearg\everyheadingxxx}
  783.  
  784. \def\evenfooting{\parsearg\evenfootingxxx}
  785. \def\oddfooting{\parsearg\oddfootingxxx}
  786. \def\everyfooting{\parsearg\everyfootingxxx}
  787.  
  788. {\catcode`\@=0 %
  789.  
  790. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  791. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  792. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  793.  
  794. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  795. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  796. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  797.  
  798. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  799. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  800. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  801. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  802.  
  803. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  804. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  805. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  806.  
  807. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  808. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  809. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  810.  
  811. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  812. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  813. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  814. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  815. %
  816. }% unbind the catcode of @.
  817.  
  818. % @headings double    turns headings on for double-sided printing.
  819. % @headings single    turns headings on for single-sided printing.
  820. % @headings off        turns them off.
  821. % @headings on        same as @headings double, retained for compatibility.
  822. % @headings after    turns on double-sided headings after this page.
  823. % @headings doubleafter    turns on double-sided headings after this page.
  824. % @headings singleafter turns on single-sided headings after this page.
  825. % By default, they are off.
  826.  
  827. \def\headings #1 {\csname HEADINGS#1\endcsname}
  828.  
  829. \def\HEADINGSoff{
  830. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  831. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  832. \HEADINGSoff
  833. % When we turn headings on, set the page number to 1.
  834. % For double-sided printing, put current file name in lower left corner,
  835. % chapter name on inside top of right hand pages, document
  836. % title on inside top of left hand pages, and page numbers on outside top
  837. % edge of all pages.
  838. \def\HEADINGSdouble{
  839. %\pagealignmacro
  840. \global\pageno=1
  841. \global\evenfootline={\hfil}
  842. \global\oddfootline={\hfil}
  843. \global\evenheadline={\line{\folio\hfil\thistitle}}
  844. \global\oddheadline={\line{\thischapter\hfil\folio}}
  845. }
  846. % For single-sided printing, chapter title goes across top left of page,
  847. % page number on top right.
  848. \def\HEADINGSsingle{
  849. %\pagealignmacro
  850. \global\pageno=1
  851. \global\evenfootline={\hfil}
  852. \global\oddfootline={\hfil}
  853. \global\evenheadline={\line{\thischapter\hfil\folio}}
  854. \global\oddheadline={\line{\thischapter\hfil\folio}}
  855. }
  856. \def\HEADINGSon{\HEADINGSdouble}
  857.  
  858. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  859. \let\HEADINGSdoubleafter=\HEADINGSafter
  860. \def\HEADINGSdoublex{%
  861. \global\evenfootline={\hfil}
  862. \global\oddfootline={\hfil}
  863. \global\evenheadline={\line{\folio\hfil\thistitle}}
  864. \global\oddheadline={\line{\thischapter\hfil\folio}}
  865. }
  866.  
  867. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  868. \def\HEADINGSsinglex{%
  869. \global\evenfootline={\hfil}
  870. \global\oddfootline={\hfil}
  871. \global\evenheadline={\line{\thischapter\hfil\folio}}
  872. \global\oddheadline={\line{\thischapter\hfil\folio}}
  873. }
  874.  
  875. % Subroutines used in generating headings
  876. % Produces Day Month Year style of output.
  877. \def\today{\number\day\space
  878. \ifcase\month\or
  879. January\or February\or March\or April\or May\or June\or
  880. July\or August\or September\or October\or November\or December\fi
  881. \space\number\year}
  882.  
  883. % Use this if you want the Month Day, Year style of output.
  884. %\def\today{\ifcase\month\or
  885. %January\or February\or March\or April\or May\or June\or
  886. %July\or August\or September\or October\or November\or December\fi
  887. %\space\number\day, \number\year}
  888.  
  889. % @settitle line...  specifies the title of the document, for headings
  890. % It generates no output of its own
  891.  
  892. \def\thistitle{No Title}
  893. \def\settitle{\parsearg\settitlezzz}
  894. \def\settitlezzz #1{\gdef\thistitle{#1}}
  895.  
  896. \message{tables,}
  897.  
  898. % @tabs -- simple alignment
  899.  
  900. % These don't work.  For one thing, \+ is defined as outer.
  901. % So these macros cannot even be defined.
  902.  
  903. %\def\tabs{\parsearg\tabszzz}
  904. %\def\tabszzz #1{\settabs\+#1\cr}
  905. %\def\tabline{\parsearg\tablinezzz}
  906. %\def\tablinezzz #1{\+#1\cr}
  907. %\def\&{&}
  908.  
  909. % Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
  910.  
  911. % default indentation of table text
  912. \newdimen\tableindent \tableindent=.8in
  913. % default indentation of @itemize and @enumerate text
  914. \newdimen\itemindent  \itemindent=.3in
  915. % margin between end of table item and start of table text.
  916. \newdimen\itemmargin  \itemmargin=.1in
  917.  
  918. % used internally for \itemindent minus \itemmargin
  919. \newdimen\itemmax
  920.  
  921. % Note @table and @ftable define @item, @itemx, etc., with these defs.
  922. % They also define \itemindex
  923. % to index the item name in whatever manner is desired (perhaps none).
  924.  
  925. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  926. \def\internalBitemx{\par \parsearg\itemzzz}
  927.  
  928. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  929. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
  930.  
  931. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  932. \def\internalBkitemx{\par \parsearg\kitemzzz}
  933.  
  934. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  935.                  \itemzzz {#1}}
  936.  
  937. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  938.                  \itemzzz {#1}}
  939.  
  940. \def\itemzzz #1{\begingroup %
  941.   \advance\hsize by -\rightskip
  942.   \advance\hsize by -\tableindent
  943.   \setbox0=\hbox{\itemfont{#1}}%
  944.   \itemindex{#1}%
  945.   \nobreak % This prevents a break before @itemx.
  946.   %
  947.   % Be sure we are not still in the middle of a paragraph.
  948.   \parskip=0in
  949.   \par
  950.   %
  951.   % If the item text does not fit in the space we have, put it on a line
  952.   % by itself, and do not allow a page break either before or after that
  953.   % line.  We do not start a paragraph here because then if the next
  954.   % command is, e.g., @kindex, the whatsit would get put into the
  955.   % horizontal list on a line by itself, resulting in extra blank space.
  956.   \ifdim \wd0>\itemmax
  957.     \setbox0=\hbox{\hskip \leftskip \hskip -\tableindent \unhbox0}\box0
  958.     \nobreak
  959.   \else
  960.     % The item text fits into the space.  Start a paragraph, so that the
  961.     % following text (if any) will end up on the same line.  Since that
  962.     % text will be indented by \tableindent, we make the item text be in
  963.     % a zero-width box.
  964.     \noindent
  965.     \rlap{\hskip -\tableindent\box0}%
  966.   \fi
  967.   \endgroup
  968. }
  969.  
  970. \def\item{\errmessage{@item while not in a table}}
  971. \def\itemx{\errmessage{@itemx while not in a table}}
  972. \def\kitem{\errmessage{@kitem while not in a table}}
  973. \def\kitemx{\errmessage{@kitemx while not in a table}}
  974. \def\xitem{\errmessage{@xitem while not in a table}}
  975. \def\xitemx{\errmessage{@xitemx while not in a table}}
  976.  
  977. %% Contains a kludge to get @end[description] to work
  978. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  979.  
  980. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  981. {\obeylines\obeyspaces%
  982. \gdef\tablex #1^^M{%
  983. \tabley\dontindex#1        \endtabley}}
  984.  
  985. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  986. {\obeylines\obeyspaces%
  987. \gdef\ftablex #1^^M{%
  988. \tabley\fnitemindex#1        \endtabley
  989. \def\Eftable{\endgraf\endgroup\afterenvbreak}%
  990. \let\Etable=\relax}}
  991.  
  992. \def\dontindex #1{}
  993. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  994.  
  995. {\obeyspaces %
  996. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  997. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  998.  
  999. \def\tablez #1#2#3#4#5#6{%
  1000. \aboveenvbreak %
  1001. \begingroup %
  1002. \def\Edescription{\Etable}% Neccessary kludge.
  1003. \let\itemindex=#1%
  1004. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1005. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1006. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1007. \def\itemfont{#2}%
  1008. \itemmax=\tableindent %
  1009. \advance \itemmax by -\itemmargin %
  1010. \advance \leftskip by \tableindent %
  1011. \parindent = 0pt
  1012. \parskip = \smallskipamount
  1013. \ifdim \parskip=0pt \parskip=2pt \fi%
  1014. \def\Etable{\endgraf\endgroup\afterenvbreak}%
  1015. \let\item = \internalBitem %
  1016. \let\itemx = \internalBitemx %
  1017. \let\kitem = \internalBkitem %
  1018. \let\kitemx = \internalBkitemx %
  1019. \let\xitem = \internalBxitem %
  1020. \let\xitemx = \internalBxitemx %
  1021. }
  1022.  
  1023. % This is the counter used by @enumerate, which is really @itemize
  1024.  
  1025. \newcount \itemno
  1026.  
  1027. \def\itemize{\parsearg\itemizezzz}
  1028.  
  1029. \def\itemizezzz #1{%
  1030.   \begingroup % ended by the @end itemsize
  1031.   \itemizey {#1}{\Eitemize}
  1032. }
  1033.  
  1034. \def\itemizey #1#2{%
  1035. \aboveenvbreak %
  1036. \itemmax=\itemindent %
  1037. \advance \itemmax by -\itemmargin %
  1038. \advance \leftskip by \itemindent %
  1039. \parindent = 0pt %
  1040. \parskip = \smallskipamount %
  1041. \ifdim \parskip=0pt \parskip=2pt \fi%
  1042. \def#2{\endgraf\endgroup\afterenvbreak}%
  1043. \def\itemcontents{#1}%
  1044. \let\item=\itemizeitem}
  1045.  
  1046. \def\bullet{$\ptexbullet$}
  1047. \def\minus{$-$}
  1048.  
  1049. % Set sfcode to normal for the chars that usually have another value.
  1050. % These are `.?!:;,'
  1051. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1052.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1053.  
  1054. % \splitoff TOKENS\endmark defines \first to be the first token in
  1055. % TOKENS, and \rest to be the remainder.
  1056. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1057.  
  1058. % Allow an optional argument of an uppercase letter, lowercase letter,
  1059. % or number, to specify the first label in the enumerated list.  No
  1060. % argument is the same as `1'.
  1061. \def\enumerate{\parsearg\enumeratezzz}
  1062. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1063. \def\enumeratey #1 #2\endenumeratey{%
  1064.   \begingroup % ended by the @end enumerate
  1065.   %
  1066.   % If we were given no argument, pretend we were given `1'.
  1067.   \def\thearg{#1}%
  1068.   \ifx\thearg\empty \def\thearg{1}\fi
  1069.   %
  1070.   % Detect if the argument is a single token.  If so, it might be a
  1071.   % letter.  Otherwise, the only valid thing it can be is a number.
  1072.   % (We will always have one token, because of the test we just made.
  1073.   % This is a good thing, since \splitoff doesn't work given nothing at
  1074.   % all -- the first parameter is undelimited.)
  1075.   \expandafter\splitoff\thearg\endmark
  1076.   \ifx\rest\empty
  1077.     % Only one token in the argument.  It could still be anything.
  1078.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1079.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1080.     %   not equal to itself.
  1081.     % Otherwise, we assume it's a number.
  1082.     % 
  1083.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1084.     % continuing to look for a <number>.
  1085.     % 
  1086.     \ifnum\lccode\expandafter`\thearg=0\relax 
  1087.       \numericenumerate % a number (we hope)
  1088.     \else
  1089.       % It's a letter.
  1090.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1091.         \lowercaseenumerate % lowercase letter
  1092.       \else
  1093.         \uppercaseenumerate % uppercase letter
  1094.       \fi
  1095.     \fi
  1096.   \else
  1097.     % Multiple tokens in the argument.  We hope it's a number.
  1098.     \numericenumerate
  1099.   \fi
  1100. }
  1101.  
  1102. % An @enumerate whose labels are integers.  The starting integer is
  1103. % given in \thearg.
  1104. \def\numericenumerate{%
  1105.   \itemno = \thearg
  1106.   \startenumeration{\the\itemno}%
  1107. }
  1108.  
  1109. % The starting (lowercase) letter is in \thearg.
  1110. \def\lowercaseenumerate{%
  1111.   \itemno = \expandafter`\thearg
  1112.   \startenumeration{%
  1113.     % Be sure we're not beyond the end of the alphabet.
  1114.     \ifnum\itemno=0
  1115.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1116.                   alphabet}%
  1117.     \fi
  1118.     \char\lccode\itemno
  1119.   }%
  1120. }
  1121.  
  1122. % The starting (uppercase) letter is in \thearg.
  1123. \def\uppercaseenumerate{%
  1124.   \itemno = \expandafter`\thearg
  1125.   \startenumeration{%
  1126.     % Be sure we're not beyond the end of the alphabet.
  1127.     \ifnum\itemno=0
  1128.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1129.                   alphabet}
  1130.     \fi
  1131.     \char\uccode\itemno
  1132.   }%
  1133. }
  1134.  
  1135. % Call itemizey, adding a period to the first argument and supplying the
  1136. % common last two arguments.  Also subtract one from the initial value in
  1137. % \itemno, since @item increments \itemno.
  1138. \def\startenumeration#1{%
  1139.   \advance\itemno by -1
  1140.   \itemizey{#1.}\Eenumerate\flushcr
  1141. }
  1142.  
  1143. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1144. % to @enumerate.
  1145. \def\alphaenumerate{\enumerate{a}}
  1146. \def\capsenumerate{\enumerate{A}}
  1147. \def\Ealphaenumerate{\Eenumerate}
  1148. \def\Ecapsenumerate{\Eenumerate}
  1149.  
  1150. % Definition of @item while inside @itemize.
  1151.  
  1152. \def\itemizeitem{%
  1153. \advance\itemno by 1
  1154. {\let\par=\endgraf \smallbreak}%
  1155. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1156. {\parskip=0in \hskip 0pt
  1157. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1158. \vadjust{\penalty 1200}}%
  1159. \flushcr}
  1160.  
  1161. \message{indexing,}
  1162. % Index generation facilities
  1163.  
  1164. % Define \newwrite to be identical to plain tex's \newwrite
  1165. % except not \outer, so it can be used within \newindex.
  1166. {\catcode`\@=11
  1167. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1168.  
  1169. % \newindex {foo} defines an index named foo.
  1170. % It automatically defines \fooindex such that
  1171. % \fooindex ...rest of line... puts an entry in the index foo.
  1172. % It also defines \fooindfile to be the number of the output channel for
  1173. % the file that    accumulates this index.  The file's extension is foo.
  1174. % The name of an index should be no more than 2 characters long
  1175. % for the sake of vms.
  1176.  
  1177. \def\newindex #1{
  1178. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1179. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1180. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1181. \noexpand\doindex {#1}}
  1182. }
  1183.  
  1184. % @defindex foo  ==  \newindex{foo}
  1185.  
  1186. \def\defindex{\parsearg\newindex}
  1187.  
  1188. % Define @defcodeindex, like @defindex except put all entries in @code.
  1189.  
  1190. \def\newcodeindex #1{
  1191. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1192. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1193. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1194. \noexpand\docodeindex {#1}}
  1195. }
  1196.  
  1197. \def\defcodeindex{\parsearg\newcodeindex}
  1198.  
  1199. % @synindex foo bar    makes index foo feed into index bar.
  1200. % Do this instead of @defindex foo if you don't want it as a separate index.
  1201. \def\synindex #1 #2 {%
  1202. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1203. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1204. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1205. \noexpand\doindex {#2}}%
  1206. }
  1207.  
  1208. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1209. % inside @code.
  1210. \def\syncodeindex #1 #2 {%
  1211. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1212. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1213. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1214. \noexpand\docodeindex {#2}}%
  1215. }
  1216.  
  1217. % Define \doindex, the driver for all \fooindex macros.
  1218. % Argument #1 is generated by the calling \fooindex macro,
  1219. %  and it is "foo", the name of the index.
  1220.  
  1221. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1222. % This is because \doind is more useful to call from other macros.
  1223.  
  1224. % There is also \dosubind {index}{topic}{subtopic}
  1225. % which makes an entry in a two-level index such as the operation index.
  1226.  
  1227. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1228. \def\singleindexer #1{\doind{\indexname}{#1}}
  1229.  
  1230. % like the previous two, but they put @code around the argument.
  1231. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1232. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1233.  
  1234. \def\indexdummies{%
  1235. \def\_{{\realbackslash _}}%
  1236. \def\w{\realbackslash w }%
  1237. \def\bf{\realbackslash bf }%
  1238. \def\rm{\realbackslash rm }%
  1239. \def\sl{\realbackslash sl }%
  1240. \def\sf{\realbackslash sf}%
  1241. \def\tt{\realbackslash tt}%
  1242. \def\gtr{\realbackslash gtr}%
  1243. \def\less{\realbackslash less}%
  1244. \def\hat{\realbackslash hat}%
  1245. \def\char{\realbackslash char}%
  1246. \def\TeX{\realbackslash TeX}%
  1247. \def\dots{\realbackslash dots }%
  1248. \def\copyright{\realbackslash copyright }%
  1249. \def\tclose##1{\realbackslash tclose {##1}}%
  1250. \def\code##1{\realbackslash code {##1}}%
  1251. \def\samp##1{\realbackslash samp {##1}}%
  1252. \def\t##1{\realbackslash r {##1}}%
  1253. \def\r##1{\realbackslash r {##1}}%
  1254. \def\i##1{\realbackslash i {##1}}%
  1255. \def\b##1{\realbackslash b {##1}}%
  1256. \def\cite##1{\realbackslash cite {##1}}%
  1257. \def\key##1{\realbackslash key {##1}}%
  1258. \def\file##1{\realbackslash file {##1}}%
  1259. \def\var##1{\realbackslash var {##1}}%
  1260. \def\kbd##1{\realbackslash kbd {##1}}%
  1261. }
  1262.  
  1263. % \indexnofonts no-ops all font-change commands.
  1264. % This is used when outputting the strings to sort the index by.
  1265. \def\indexdummyfont#1{#1}
  1266. \def\indexdummytex{TeX}
  1267. \def\indexdummydots{...}
  1268.  
  1269. \def\indexnofonts{%
  1270. \let\w=\indexdummyfont
  1271. \let\t=\indexdummyfont
  1272. \let\r=\indexdummyfont
  1273. \let\i=\indexdummyfont
  1274. \let\b=\indexdummyfont
  1275. \let\emph=\indexdummyfont
  1276. \let\strong=\indexdummyfont
  1277. \let\cite=\indexdummyfont
  1278. \let\sc=\indexdummyfont
  1279. %Don't no-op \tt, since it isn't a user-level command
  1280. % and is used in the definitions of the active chars like <, >, |...
  1281. %\let\tt=\indexdummyfont
  1282. \let\tclose=\indexdummyfont
  1283. \let\code=\indexdummyfont
  1284. \let\file=\indexdummyfont
  1285. \let\samp=\indexdummyfont
  1286. \let\kbd=\indexdummyfont
  1287. \let\key=\indexdummyfont
  1288. \let\var=\indexdummyfont
  1289. \let\TeX=\indexdummytex
  1290. \let\dots=\indexdummydots
  1291. }
  1292.  
  1293. % To define \realbackslash, we must make \ not be an escape.
  1294. % We must first make another character (@) an escape
  1295. % so we do not become unable to do a definition.
  1296.  
  1297. {\catcode`\@=0 \catcode`\\=\other
  1298. @gdef@realbackslash{\}}
  1299.  
  1300. \let\indexbackslash=0  %overridden during \printindex.
  1301.  
  1302. \def\doind #1#2{%
  1303. {\count10=\lastpenalty %
  1304. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1305. \escapechar=`\\%
  1306. {\let\folio=0% Expand all macros now EXCEPT \folio
  1307. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1308. % so it will be output as is; and it will print as backslash in the indx.
  1309. %
  1310. % Now process the index-string once, with all font commands turned off,
  1311. % to get the string to sort the index by.
  1312. {\indexnofonts
  1313. \xdef\temp1{#2}%
  1314. }%
  1315. % Now produce the complete index entry.  We process the index-string again,
  1316. % this time with font commands expanded, to get what to print in the index.
  1317. \edef\temp{%
  1318. \write \csname#1indfile\endcsname{%
  1319. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1320. \temp }%
  1321. }\penalty\count10}}
  1322.  
  1323. \def\dosubind #1#2#3{%
  1324. {\count10=\lastpenalty %
  1325. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1326. \escapechar=`\\%
  1327. {\let\folio=0%
  1328. \def\rawbackslashxx{\indexbackslash}%
  1329. %
  1330. % Now process the index-string once, with all font commands turned off,
  1331. % to get the string to sort the index by.
  1332. {\indexnofonts
  1333. \xdef\temp1{#2 #3}%
  1334. }%
  1335. % Now produce the complete index entry.  We process the index-string again,
  1336. % this time with font commands expanded, to get what to print in the index.
  1337. \edef\temp{%
  1338. \write \csname#1indfile\endcsname{%
  1339. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1340. \temp }%
  1341. }\penalty\count10}}
  1342.  
  1343. % The index entry written in the file actually looks like
  1344. %  \entry {sortstring}{page}{topic}
  1345. % or
  1346. %  \entry {sortstring}{page}{topic}{subtopic}
  1347. % The texindex program reads in these files and writes files
  1348. % containing these kinds of lines:
  1349. %  \initial {c}
  1350. %     before the first topic whose initial is c
  1351. %  \entry {topic}{pagelist}
  1352. %     for a topic that is used without subtopics
  1353. %  \primary {topic}
  1354. %     for the beginning of a topic that is used with subtopics
  1355. %  \secondary {subtopic}{pagelist}
  1356. %     for each subtopic.
  1357.  
  1358. % Define the user-accessible indexing commands 
  1359. % @findex, @vindex, @kindex, @cindex.
  1360.  
  1361. \def\findex {\fnindex}
  1362. \def\kindex {\kyindex}
  1363. \def\cindex {\cpindex}
  1364. \def\vindex {\vrindex}
  1365. \def\tindex {\tpindex}
  1366. \def\pindex {\pgindex}
  1367.  
  1368. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1369. {\obeylines %
  1370. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1371. \dosubind{cp}{#2}{#1}}}
  1372.  
  1373. % Define the macros used in formatting output of the sorted index material.
  1374.  
  1375. % This is what you call to cause a particular index to get printed.
  1376. % Write
  1377. % @unnumbered Function Index
  1378. % @printindex fn
  1379.  
  1380. \def\printindex{\parsearg\doprintindex}
  1381.  
  1382. \def\doprintindex#1{%
  1383.   \tex
  1384.   \dobreak \chapheadingskip {10000}
  1385.   \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1386.   \catcode`\$=\other\catcode`\_=\other
  1387.   \catcode`\~=\other
  1388.   %
  1389.   % The following don't help, since the chars were translated
  1390.   % when the raw index was written, and their fonts were discarded
  1391.   % due to \indexnofonts.
  1392.   %\catcode`\"=\active
  1393.   %\catcode`\^=\active
  1394.   %\catcode`\_=\active
  1395.   %\catcode`\|=\active
  1396.   %\catcode`\<=\active
  1397.   %\catcode`\>=\active
  1398.   % %
  1399.   \def\indexbackslash{\rawbackslashxx}
  1400.   \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1401.   \begindoublecolumns
  1402.   %
  1403.   % See if the index file exists and is nonempty.
  1404.   \openin 1 \jobname.#1s
  1405.   \ifeof 1 
  1406.     % \enddoublecolumns gets confused if there is no text in the index,
  1407.     % and it loses the chapter title and the aux file entries for the
  1408.     % index.  The easiest way to prevent this problem is to make sure
  1409.     % there is some text.
  1410.     (Index is nonexistent)
  1411.     \else
  1412.     %
  1413.     % If the index file exists but is empty, then \openin leaves \ifeof
  1414.     % false.  We have to make TeX try to read something from the file, so
  1415.     % it can discover if there is anything in it.
  1416.     \read 1 to \temp
  1417.     \ifeof 1
  1418.       (Index is empty)
  1419.     \else
  1420.       \input \jobname.#1s
  1421.     \fi
  1422.   \fi
  1423.   \closein 1
  1424.   \enddoublecolumns
  1425.   \Etex
  1426. }
  1427.  
  1428. % These macros are used by the sorted index file itself.
  1429. % Change them to control the appearance of the index.
  1430.  
  1431. % Same as \bigskipamount except no shrink.
  1432. % \balancecolumns gets confused if there is any shrink.
  1433. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1434.  
  1435. \def\initial #1{%
  1436. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1437. \ifdim\lastskip<\initialskipamount
  1438. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1439. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1440.  
  1441. \def\entry #1#2{\begingroup
  1442.   \parfillskip=0in \parskip=0in \parindent=0in
  1443.   %
  1444.   % \hangindent is only relevant when the page number and the entry text
  1445.   % don't fit on one line.  In that case, bob suggests starting the dots
  1446.   % pretty far over on the line.
  1447.   % \hangafter is reset to 1 at the start of each paragraph.
  1448.   \hangindent=.75\hsize
  1449.   \noindent
  1450.   %
  1451.   % Don't break the text of the index entry.
  1452.   \hbox{#1}%
  1453.   %
  1454.   % If we must, put the page number on a line of its own, and fill out
  1455.   % this line with blank space.  (The \hfil is overwhelmed with the
  1456.   % fill leaders glue in \indexdotfill if the page number does fit.)
  1457.   \hfil\penalty50
  1458.   \null\nobreak\indexdotfill % Have leaders before the page number.
  1459.   %
  1460.   % The `\ ' here is removed by the implicit \unskip that TeX does as
  1461.   % part of (the primitive) \par.  Without, a spurious underfull \hbox ensues.
  1462.   \ #2% The page number ends the paragraph.
  1463.   \par
  1464. \endgroup}
  1465.  
  1466. % Like \dotfill except takes at least 1 em.
  1467. \def\indexdotfill{\cleaders
  1468.   \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
  1469.  
  1470. \def\primary #1{\line{#1\hfil}}
  1471.  
  1472. \newskip\secondaryindent \secondaryindent=0.5cm
  1473.  
  1474. \def\secondary #1#2{
  1475. {\parfillskip=0in \parskip=0in
  1476. \hangindent =1in \hangafter=1
  1477. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1478. }}
  1479.  
  1480. %% Define two-column mode, which is used in indexes.
  1481. %% Adapted from the TeXBook, page 416
  1482. \catcode `\@=11
  1483.  
  1484. \newbox\partialpage
  1485.  
  1486. \newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
  1487. \newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
  1488. \newdimen\availdimen@
  1489.  
  1490. \def\begindoublecolumns{\begingroup
  1491.   \output={\global\setbox\partialpage=
  1492.     \vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
  1493.   \output={\doublecolumnout}%
  1494.   \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
  1495. \def\enddoublecolumns{\output={\balancecolumns}\eject
  1496.   \endgroup \pagegoal=\vsize}
  1497.  
  1498. \def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1499.   \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1500.   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1501.   \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
  1502. \def\pagesofar{\unvbox\partialpage %
  1503.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1504. %          changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
  1505.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1506. \def\balancecolumns{%
  1507. % Unset the glue.
  1508.   \setbox255=\vbox{\unvbox255}
  1509.   \dimen@=\ht255
  1510.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1511.   \divide\dimen@ by2
  1512.   \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpage
  1513. % If the remaining data is too big for one page,
  1514. % output one page normally, then work with what remains.
  1515.   \ifdim \dimen@>\availdimen@
  1516.    {
  1517.      \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1518.      \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1519.      \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1520.      \onepageout\pagesofar
  1521.    }
  1522. % Recompute size of what remains, in case we just output some of it.
  1523.   \dimen@=\ht255
  1524.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1525.   \divide\dimen@ by2
  1526.   \fi
  1527.   \setbox0=\vbox{\unvbox255}
  1528.   \splittopskip=\topskip
  1529.   {\vbadness=10000 \loop \global\setbox3=\copy0
  1530.     \global\setbox1=\vsplit3 to\dimen@
  1531.     \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
  1532.   \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
  1533.   \pagesofar}
  1534.  
  1535. \catcode `\@=\other
  1536. \message{sectioning,}
  1537. % Define chapters, sections, etc.
  1538.  
  1539. \newcount \chapno
  1540. \newcount \secno        \secno=0
  1541. \newcount \subsecno     \subsecno=0
  1542. \newcount \subsubsecno  \subsubsecno=0
  1543.  
  1544. % This counter is funny since it counts through charcodes of letters A, B, ...
  1545. \newcount \appendixno  \appendixno = `\@
  1546. \def\appendixletter{\char\the\appendixno}
  1547.  
  1548. \newwrite \contentsfile
  1549. % This is called from \setfilename.
  1550. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1551.  
  1552. % Each @chapter defines this as the name of the chapter.
  1553. % page headings and footings can use it.  @section does likewise
  1554.  
  1555. \def\thischapter{} \def\thissection{}
  1556. \def\seccheck#1{\if \pageno<0 %
  1557. \errmessage{@#1 not allowed after generating table of contents}\fi
  1558. %
  1559. }
  1560.  
  1561. \def\chapternofonts{%
  1562. \let\rawbackslash=\relax%
  1563. \let\frenchspacing=\relax%
  1564. \def\result{\realbackslash result}
  1565. \def\equiv{\realbackslash equiv}
  1566. \def\expansion{\realbackslash expansion}
  1567. \def\print{\realbackslash print}
  1568. \def\TeX{\realbackslash TeX}
  1569. \def\dots{\realbackslash dots}
  1570. \def\copyright{\realbackslash copyright}
  1571. \def\tt{\realbackslash tt}
  1572. \def\bf{\realbackslash bf }
  1573. \def\w{\realbackslash w}
  1574. \def\less{\realbackslash less}
  1575. \def\gtr{\realbackslash gtr}
  1576. \def\hat{\realbackslash hat}
  1577. \def\char{\realbackslash char}
  1578. \def\tclose##1{\realbackslash tclose {##1}}
  1579. \def\code##1{\realbackslash code {##1}}
  1580. \def\samp##1{\realbackslash samp {##1}}
  1581. \def\r##1{\realbackslash r {##1}}
  1582. \def\b##1{\realbackslash b {##1}}
  1583. \def\key##1{\realbackslash key {##1}}
  1584. \def\file##1{\realbackslash file {##1}}
  1585. \def\kbd##1{\realbackslash kbd {##1}}
  1586. % These are redefined because @smartitalic wouldn't work inside xdef.
  1587. \def\i##1{\realbackslash i {##1}}
  1588. \def\cite##1{\realbackslash cite {##1}}
  1589. \def\var##1{\realbackslash var {##1}}
  1590. \def\emph##1{\realbackslash emph {##1}}
  1591. \def\dfn##1{\realbackslash dfn {##1}}
  1592. }
  1593.  
  1594. \def\thischaptername{No Chapter Title}
  1595. \outer\def\chapter{\parsearg\chapterzzz}
  1596. \def\chapterzzz #1{\seccheck{chapter}%
  1597. \secno=0 \subsecno=0 \subsubsecno=0
  1598. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1599. \chapmacro {#1}{\the\chapno}%
  1600. \gdef\thissection{#1}%
  1601. \gdef\thischaptername{#1}%
  1602. % We don't substitute the actual chapter name into \thischapter
  1603. % because we don't want its macros evaluated now.
  1604. \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
  1605. {\chapternofonts%
  1606. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1607. \escapechar=`\\%
  1608. \write \contentsfile \temp  %
  1609. \donoderef %
  1610. \global\let\section = \numberedsec
  1611. \global\let\subsection = \numberedsubsec
  1612. \global\let\subsubsection = \numberedsubsubsec
  1613. }}
  1614.  
  1615. \outer\def\appendix{\parsearg\appendixzzz}
  1616. \def\appendixzzz #1{\seccheck{appendix}%
  1617. \secno=0 \subsecno=0 \subsubsecno=0
  1618. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1619. \chapmacro {#1}{Appendix \appendixletter}%
  1620. \gdef\thissection{#1}%
  1621. \gdef\thischaptername{#1}%
  1622. \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
  1623. {\chapternofonts%
  1624. \edef\temp{{\realbackslash chapentry 
  1625.   {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1626. \escapechar=`\\%
  1627. \write \contentsfile \temp  %
  1628. \appendixnoderef %
  1629. \global\let\section = \appendixsec
  1630. \global\let\subsection = \appendixsubsec
  1631. \global\let\subsubsection = \appendixsubsubsec
  1632. }}
  1633.  
  1634. \outer\def\top{\parsearg\unnumberedzzz}
  1635. \outer\def\unnumbered{\parsearg\unnumberedzzz}
  1636. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1637. \secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
  1638. \unnumbchapmacro {#1}%
  1639. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1640. {\chapternofonts%
  1641. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1642. \escapechar=`\\%
  1643. \write \contentsfile \temp  %
  1644. \unnumbnoderef %
  1645. \global\let\section = \unnumberedsec
  1646. \global\let\subsection = \unnumberedsubsec
  1647. \global\let\subsubsection = \unnumberedsubsubsec
  1648. }}
  1649.  
  1650. \outer\def\numberedsec{\parsearg\seczzz}
  1651. \def\seczzz #1{\seccheck{section}%
  1652. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1653. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1654. {\chapternofonts%
  1655. \edef\temp{{\realbackslash secentry %
  1656. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1657. \escapechar=`\\%
  1658. \write \contentsfile \temp %
  1659. \donoderef %
  1660. \penalty 10000 %
  1661. }}
  1662.  
  1663. \outer\def\appendixsection{\parsearg\appendixsectionzzz}
  1664. \outer\def\appendixsec{\parsearg\appendixsectionzzz}
  1665. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1666. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1667. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1668. {\chapternofonts%
  1669. \edef\temp{{\realbackslash secentry %
  1670. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1671. \escapechar=`\\%
  1672. \write \contentsfile \temp %
  1673. \appendixnoderef %
  1674. \penalty 10000 %
  1675. }}
  1676.  
  1677. \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
  1678. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1679. \plainsecheading {#1}\gdef\thissection{#1}%
  1680. {\chapternofonts%
  1681. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1682. \escapechar=`\\%
  1683. \write \contentsfile \temp %
  1684. \unnumbnoderef %
  1685. \penalty 10000 %
  1686. }}
  1687.  
  1688. \outer\def\numberedsubsec{\parsearg\numberedsubseczzz}
  1689. \def\numberedsubseczzz #1{\seccheck{subsection}%
  1690. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1691. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1692. {\chapternofonts%
  1693. \edef\temp{{\realbackslash subsecentry %
  1694. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1695. \escapechar=`\\%
  1696. \write \contentsfile \temp %
  1697. \donoderef %
  1698. \penalty 10000 %
  1699. }}
  1700.  
  1701. \outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
  1702. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1703. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1704. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1705. {\chapternofonts%
  1706. \edef\temp{{\realbackslash subsecentry %
  1707. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1708. \escapechar=`\\%
  1709. \write \contentsfile \temp %
  1710. \appendixnoderef %
  1711. \penalty 10000 %
  1712. }}
  1713.  
  1714. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1715. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1716. \plainsecheading {#1}\gdef\thissection{#1}%
  1717. {\chapternofonts%
  1718. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1719. \escapechar=`\\%
  1720. \write \contentsfile \temp %
  1721. \unnumbnoderef %
  1722. \penalty 10000 %
  1723. }}
  1724.  
  1725. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubseczzz}
  1726. \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
  1727. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1728. \subsubsecheading {#1}
  1729.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1730. {\chapternofonts%
  1731. \edef\temp{{\realbackslash subsubsecentry %
  1732.   {#1}
  1733.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  1734.   {\noexpand\folio}}}%
  1735. \escapechar=`\\%
  1736. \write \contentsfile \temp %
  1737. \donoderef %
  1738. \penalty 10000 %
  1739. }}
  1740.  
  1741. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1742. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1743. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1744. \subsubsecheading {#1}
  1745.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1746. {\chapternofonts%
  1747. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1748.   {\appendixletter}
  1749.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  1750. \escapechar=`\\%
  1751. \write \contentsfile \temp %
  1752. \appendixnoderef %
  1753. \penalty 10000 %
  1754. }}
  1755.  
  1756. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1757. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1758. \plainsecheading {#1}\gdef\thissection{#1}%
  1759. {\chapternofonts%
  1760. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1761. \escapechar=`\\%
  1762. \write \contentsfile \temp %
  1763. \unnumbnoderef %
  1764. \penalty 10000 %
  1765. }}
  1766.  
  1767. % These are variants which are not "outer", so they can appear in @ifinfo.
  1768. % Actually, they should now be obsolete; ordinary section commands should work.
  1769. \def\infotop{\parsearg\unnumberedzzz}
  1770. \def\infounnumbered{\parsearg\unnumberedzzz}
  1771. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1772. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1773. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1774.  
  1775. \def\infoappendix{\parsearg\appendixzzz}
  1776. \def\infoappendixsec{\parsearg\appendixseczzz}
  1777. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1778. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1779.  
  1780. \def\infochapter{\parsearg\chapterzzz}
  1781. \def\infosection{\parsearg\sectionzzz}
  1782. \def\infosubsection{\parsearg\subsectionzzz}
  1783. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  1784.  
  1785. % These macros control what the section commands do, according
  1786. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  1787. % Define them by default for a numbered chapter.
  1788. \global\let\section = \numberedsec
  1789. \global\let\subsection = \numberedsubsec
  1790. \global\let\subsubsection = \numberedsubsubsec
  1791.  
  1792. % Define @majorheading, @heading and @subheading
  1793.  
  1794. % NOTE on use of \vbox for chapter headings, section headings, and
  1795. % such:
  1796. %    1) We use \vbox rather than the earlier \line to permit
  1797. %       overlong headings to fold.
  1798. %    2) \hyphenpenalty is set to 10000 because hyphenation in a
  1799. %       heading is obnoxious; this forbids it.
  1800. %       3) Likewise, headings look best if no \parindent is used, and
  1801. %          if justification is not attempted.  Hence \raggedright.
  1802.  
  1803.  
  1804. \def\majorheading{\parsearg\majorheadingzzz}
  1805. \def\majorheadingzzz #1{%
  1806. {\advance\chapheadingskip by 10pt \chapbreak }%
  1807. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1808.                   \parindent=0pt\raggedright
  1809.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1810.  
  1811. \def\chapheading{\parsearg\chapheadingzzz}
  1812. \def\chapheadingzzz #1{\chapbreak %
  1813. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1814.                   \parindent=0pt\raggedright
  1815.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  1816.  
  1817. \def\heading{\parsearg\secheadingi}
  1818.  
  1819. \def\subheading{\parsearg\subsecheadingi}
  1820.  
  1821. \def\subsubheading{\parsearg\subsubsecheadingi}
  1822.  
  1823. % These macros generate a chapter, section, etc. heading only
  1824. % (including whitespace, linebreaking, etc. around it),
  1825. % given all the information in convenient, parsed form.
  1826.  
  1827. %%% Args are the skip and penalty (usually negative)
  1828. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1829.  
  1830. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1831.  
  1832. %%% Define plain chapter starts, and page on/off switching for it
  1833. % Parameter controlling skip before chapter headings (if needed)
  1834.  
  1835. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1836.  
  1837. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1838. \def\chappager{\par\vfill\supereject}
  1839. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1840.  
  1841. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1842.  
  1843. \def\CHAPPAGoff{
  1844. \global\let\pchapsepmacro=\chapbreak
  1845. \global\let\pagealignmacro=\chappager}
  1846.  
  1847. \def\CHAPPAGon{
  1848. \global\let\pchapsepmacro=\chappager
  1849. \global\let\pagealignmacro=\chappager
  1850. \global\def\HEADINGSon{\HEADINGSsingle}}
  1851.  
  1852. \def\CHAPPAGodd{
  1853. \global\let\pchapsepmacro=\chapoddpage
  1854. \global\let\pagealignmacro=\chapoddpage
  1855. \global\def\HEADINGSon{\HEADINGSdouble}}
  1856.  
  1857. \CHAPPAGon
  1858.  
  1859. \def\CHAPFplain{
  1860. \global\let\chapmacro=\chfplain
  1861. \global\let\unnumbchapmacro=\unnchfplain}
  1862.  
  1863. \def\chfplain #1#2{%
  1864.   \pchapsepmacro
  1865.   {%
  1866.     \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1867.                      \parindent=0pt\raggedright
  1868.                      \rm #2\enspace #1}%
  1869.   }%
  1870.   \bigskip
  1871.   \penalty5000
  1872. }
  1873.  
  1874. \def\unnchfplain #1{%
  1875. \pchapsepmacro %
  1876. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1877.                   \parindent=0pt\raggedright
  1878.                   \rm #1\hfill}}\bigskip \par\penalty 10000 %
  1879. }
  1880. \CHAPFplain % The default
  1881.  
  1882. \def\unnchfopen #1{%
  1883. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1884.                        \parindent=0pt\raggedright
  1885.                        \rm #1\hfill}}\bigskip \par\penalty 10000 %
  1886. }
  1887.  
  1888. \def\chfopen #1#2{\chapoddpage {\chapfonts
  1889. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1890. \par\penalty 5000 %
  1891. }
  1892.  
  1893. \def\CHAPFopen{
  1894. \global\let\chapmacro=\chfopen
  1895. \global\let\unnumbchapmacro=\unnchfopen}
  1896.  
  1897. % Parameter controlling skip before section headings.
  1898.  
  1899. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  1900. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1901.  
  1902. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  1903. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  1904.  
  1905. % @paragraphindent  is defined for the Info formatting commands only.
  1906. \let\paragraphindent=\comment
  1907.  
  1908. % Section fonts are the base font at magstep2, which produces
  1909. % a size a bit more than 14 points in the default situation.    
  1910.  
  1911. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  1912. \def\plainsecheading #1{\secheadingi {#1}}
  1913. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  1914. \secheadingbreak}%
  1915. {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1916.                  \parindent=0pt\raggedright
  1917.                  \rm #1\hfill}}%
  1918. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1919.  
  1920.  
  1921. % Subsection fonts are the base font at magstep1, 
  1922. % which produces a size of 12 points.
  1923.  
  1924. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  1925. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1926. \subsecheadingbreak}%
  1927. {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1928.                      \parindent=0pt\raggedright
  1929.                      \rm #1\hfill}}%
  1930. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1931.  
  1932. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  1933.                   % Perhaps make sssec fonts scaled
  1934.                   % magstep half
  1935. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  1936. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1937. \subsecheadingbreak}%
  1938. {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  1939.                        \parindent=0pt\raggedright
  1940.                        \rm #1\hfill}}%
  1941. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  1942.  
  1943.  
  1944. \message{toc printing,}
  1945.  
  1946. % Finish up the main text and prepare to read what we've written
  1947. % to \contentsfile.
  1948.  
  1949. \newskip\contentsrightmargin \contentsrightmargin=1in
  1950. \def\startcontents#1{%
  1951.    \ifnum \pageno>0
  1952.       \pageno = -1        % Request roman numbered pages.
  1953.    \fi
  1954.    \pagealignmacro
  1955.    \immediate\closeout \contentsfile
  1956.    % Don't need to put `Contents' or `Short Contents' in the headline. 
  1957.    % It is abundantly clear what they are.
  1958.    \unnumbchapmacro{#1}\def\thischapter{}%
  1959.    \begingroup           % Set up to handle contents files properly.
  1960.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  1961.       \raggedbottom             % Worry more about breakpoints than the bottom.
  1962.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  1963. }
  1964.  
  1965.   
  1966. % Normal (long) toc.
  1967. \outer\def\contents{%
  1968.    \startcontents{Table of Contents}%
  1969.       \input \jobname.toc
  1970.    \endgroup
  1971.    \vfill \eject
  1972. }
  1973.  
  1974. % And just the chapters.
  1975. \outer\def\summarycontents{%
  1976.    \startcontents{Short Contents}%
  1977.       %
  1978.       \let\chapentry = \shortchapentry
  1979.       \let\unnumbchapentry = \shortunnumberedentry
  1980.       % We want a true roman here for the page numbers.
  1981.       \secfonts
  1982.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  1983.       \rm
  1984.       \advance\baselineskip by 1pt % Open it up a little.
  1985.       \def\secentry ##1##2##3##4{}
  1986.       \def\unnumbsecentry ##1##2{}
  1987.       \def\subsecentry ##1##2##3##4##5{}
  1988.       \def\unnumbsubsecentry ##1##2{}
  1989.       \def\subsubsecentry ##1##2##3##4##5##6{}
  1990.       \def\unnumbsubsubsecentry ##1##2{}
  1991.       \input \jobname.toc
  1992.    \endgroup
  1993.    \vfill \eject
  1994. }
  1995. \let\shortcontents = \summarycontents
  1996.  
  1997. % These macros generate individual entries in the table of contents.
  1998. % The first argument is the chapter or section name.
  1999. % The last argument is the page number.
  2000. % The arguments in between are the chapter number, section number, ...
  2001.  
  2002. % Chapter-level things, for both the long and short contents.
  2003. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  2004.  
  2005. % See comments in \dochapentry re vbox and related settings
  2006. \def\shortchapentry#1#2#3{%
  2007.    \vbox{\hyphenpenalty=10000\tolerance=5000
  2008.     \parindent=0pt\strut\raggedright
  2009.     {#2\labelspace #1}\dotfill\doshortpageno{#3}}%
  2010. }
  2011.  
  2012. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  2013. \def\shortunnumberedentry#1#2{%
  2014.    \vbox{\hyphenpenalty=10000\tolerance=5000
  2015.     \parindent=0pt\strut\raggedright
  2016.     #1\dotfill\doshortpageno{#2}}%
  2017. }
  2018.  
  2019. % Sections.
  2020. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  2021. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  2022.  
  2023. % Subsections.
  2024. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  2025. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  2026.  
  2027. % And subsubsections.
  2028. \def\subsubsecentry#1#2#3#4#5#6{%
  2029.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  2030. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  2031.  
  2032.  
  2033. % This parameter controls the indentation of the various levels.
  2034. \newdimen\tocindent \tocindent = 3pc
  2035.  
  2036. % Now for the actual typesetting. In all these, #1 is the text and #2 is the 
  2037. % page number.
  2038. %
  2039. % If the toc has to be broken over pages, we would want to be at chapters 
  2040. % if at all possible; hence the \penalty.
  2041. \def\dochapentry#1#2{%
  2042.    \penalty-300 \vskip\baselineskip
  2043.    % This \vbox (and similar ones in dosecentry etc.) used to be a
  2044.    % \line; changed to permit linebreaks for long headings.  See
  2045.    % comments above \majorheading.  Here we also use \strut to
  2046.    % keep the top end of the vbox from jamming up against the previous
  2047.    % entry in the table of contents.
  2048.    \vbox{\chapentryfonts
  2049.      \hyphenpenalty=10000\tolerance=5000 % this line and next introduced
  2050.      \parindent=0pt\strut\raggedright    % with \line -> \vbox change
  2051.      #1\dotfill
  2052.      \dopageno{#2}}%
  2053.    \nobreak\vskip .25\baselineskip
  2054. }
  2055.  
  2056. \def\dosecentry#1#2{%
  2057.    \vbox{\secentryfonts \leftskip=\tocindent
  2058.     \hyphenpenalty=10000\tolerance=5000
  2059.     \parindent=0pt\strut\raggedright #1\dotfill
  2060.     \dopageno{#2}}%
  2061. }
  2062.  
  2063. \def\dosubsecentry#1#2{%
  2064.    \vbox{\subsecentryfonts \leftskip=2\tocindent
  2065.     \hyphenpenalty=10000\tolerance=5000
  2066.     \parindent=0pt\strut\raggedright #1\dotfill
  2067.     \dopageno{#2}}%
  2068. }
  2069.  
  2070. \def\dosubsubsecentry#1#2{%
  2071.    \vbox{\subsubsecentryfonts \leftskip=3\tocindent
  2072.     \hyphenpenalty=10000\tolerance=5000
  2073.     \parindent=0pt\strut\raggedright #1\dotfill
  2074.     \dopageno{#2}}%
  2075. }
  2076.  
  2077. % Space between chapter (or whatever) number and the title.
  2078. \def\labelspace{\hskip1em \relax}
  2079.  
  2080. \def\dopageno#1{{\rm #1}}
  2081. \def\doshortpageno#1{{\rm #1}}
  2082.  
  2083. \def\chapentryfonts{\secfonts \rm}
  2084. \def\secentryfonts{\textfonts}
  2085. \let\subsecentryfonts = \textfonts
  2086. \let\subsubsecentryfonts = \textfonts
  2087.  
  2088.  
  2089. \message{environments,}
  2090.  
  2091. % Since these characters are used in examples, it should be an even number of 
  2092. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2093. % Furthermore, these definitions must come after we define our fonts.
  2094. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2095. \newbox\pushcharbox    \newbox\bullbox
  2096. \newbox\equivbox       \newbox\errorbox
  2097.  
  2098. \let\ptexequiv = \equiv
  2099.  
  2100. %{\tentt
  2101. %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  2102. %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  2103. %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  2104. %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  2105. % Adapted from the manmac format (p.420 of TeXbook)
  2106. %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  2107. %                                      depth .1ex\hfil}
  2108. %}
  2109.  
  2110. \def\point{$\star$}
  2111.  
  2112. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  2113. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  2114. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  2115.  
  2116. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  2117.  
  2118. % Adapted from the TeXbook's \boxit.
  2119. {\tentt \global\dimen0 = 3em}% Width of the box.
  2120. \dimen2 = .55pt % Thickness of rules
  2121. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  2122. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  2123.  
  2124. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  2125.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  2126.    \advance\hsize by -2\dimen2 % Rules.
  2127.    \vbox{
  2128.       \hrule height\dimen2
  2129.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  2130.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  2131.          \kern3pt\vrule width\dimen2}% Space to right.
  2132.       \hrule height\dimen2}
  2133.     \hfil}
  2134.  
  2135. % The @error{} command.
  2136. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  2137.  
  2138. % @tex ... @end tex    escapes into raw Tex temporarily.
  2139. % One exception: @ is still an escape character, so that @end tex works.
  2140. % But \@ or @@ will get a plain tex @ character.
  2141.  
  2142. \def\tex{\begingroup
  2143. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  2144. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  2145. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  2146. \catcode `\%=14
  2147. \catcode 43=12
  2148. \catcode`\"=12
  2149. \catcode`\==12
  2150. \catcode`\|=12
  2151. \catcode`\<=12
  2152. \catcode`\>=12
  2153. \escapechar=`\\
  2154. %
  2155. \let\{=\ptexlbrace
  2156. \let\}=\ptexrbrace
  2157. \let\.=\ptexdot
  2158. \let\*=\ptexstar
  2159. \let\dots=\ptexdots
  2160. \def\@{@}%
  2161. \let\bullet=\ptexbullet
  2162. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  2163. \let\L=\ptexL
  2164. %
  2165. \let\Etex=\endgroup}
  2166.  
  2167. % Define @lisp ... @endlisp.
  2168. % @lisp does a \begingroup so it can rebind things,
  2169. % including the definition of @endlisp (which normally is erroneous).
  2170.  
  2171. % Amount to narrow the margins by for @lisp.
  2172. \newskip\lispnarrowing \lispnarrowing=0.4in
  2173.  
  2174. % This is the definition that ^M gets inside @lisp
  2175. % phr: changed space to \null, to avoid overfull hbox problems.
  2176. {\obeyspaces%
  2177. \gdef\lisppar{\null\endgraf}}
  2178.  
  2179. % Cause \obeyspaces to make each Space cause a word-separation
  2180. % rather than the default which is that it acts punctuation.
  2181. % This is because space in tt font looks funny.
  2182. {\obeyspaces %
  2183. \gdef\sepspaces{\def {\ }}}
  2184.  
  2185. \newskip\aboveenvskipamount \aboveenvskipamount= 0pt
  2186. \def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
  2187. \endgraf \ifdim\lastskip<\aboveenvskipamount
  2188. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
  2189.  
  2190. \def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
  2191. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
  2192.  
  2193. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  2194. \let\nonarrowing=\relax
  2195.  
  2196. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2197. % \cartouche: draw rectangle w/rounded corners around argument
  2198. \font\circle=lcircle10
  2199. \newdimen\circthick
  2200. \newdimen\cartouter\newdimen\cartinner
  2201. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  2202. \circthick=\fontdimen8\circle
  2203. %
  2204. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  2205. \def\ctr{{\hskip 6pt\circle\char'010}}
  2206. \def\cbl{{\circle\char'012\hskip -6pt}}
  2207. \def\cbr{{\hskip 6pt\circle\char'011}}
  2208. \def\carttop{\hbox to \cartouter{\hskip\lskip
  2209.     \ctl\leaders\hrule height\circthick\hfil\ctr
  2210.     \hskip\rskip}}
  2211. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  2212.     \cbl\leaders\hrule height\circthick\hfil\cbr
  2213.     \hskip\rskip}}
  2214. %
  2215. \newskip\lskip\newskip\rskip
  2216.  
  2217. \long\def\cartouche{%
  2218. \begingroup
  2219.     \lskip=\leftskip \rskip=\rightskip
  2220.     \leftskip=0pt\rightskip=0pt %we want these *outside*.
  2221.     \cartinner=\hsize \advance\cartinner by-\lskip 
  2222.                \advance\cartinner by-\rskip
  2223.     \cartouter=\hsize
  2224.     \advance\cartouter by 18pt % allow for 3pt kerns on either
  2225. %                     side, and for 6pt waste from
  2226. %                     each corner char
  2227.     \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  2228.     % Flag to tell @lisp, etc., not to narrow margin.
  2229.     \let\nonarrowing=\comment
  2230.     \vbox\bgroup
  2231.         \baselineskip=0pt\parskip=0pt\lineskip=0pt
  2232.         \carttop
  2233.         \hbox\bgroup
  2234.             \hskip\lskip
  2235.             \vrule\kern3pt
  2236.             \vbox\bgroup
  2237.                 \hsize=\cartinner
  2238.                 \kern3pt
  2239.                 \begingroup
  2240.                     \baselineskip=\normbskip
  2241.                     \lineskip=\normlskip
  2242.                     \parskip=\normpskip
  2243.                     \vskip -\parskip
  2244. \def\Ecartouche{%
  2245.                 \endgroup
  2246.                 \kern3pt
  2247.             \egroup
  2248.             \kern3pt\vrule
  2249.             \hskip\rskip
  2250.         \egroup
  2251.         \cartbot
  2252.     \egroup
  2253. \endgroup
  2254. }}    
  2255.  
  2256. \def\lisp{\aboveenvbreak
  2257. \begingroup\inENV % This group ends at the end of the @lisp body
  2258. \hfuzz=12truept % Don't be fussy
  2259. % Make spaces be word-separators rather than space tokens.
  2260. \sepspaces %
  2261. % Single space lines
  2262. \singlespace %
  2263. % The following causes blank lines not to be ignored
  2264. % by adding a space to the end of each line.
  2265. \let\par=\lisppar
  2266. \def\Elisp{\endgroup\afterenvbreak}%
  2267. \parskip=0pt
  2268. % @cartouche defines \nonarrowing to inhibit narrowing
  2269. % at next level down.
  2270. \ifx\nonarrowing\relax
  2271. \advance \leftskip by \lispnarrowing
  2272. \let\nonarrowing=\relax
  2273. \fi
  2274. \parindent=0pt
  2275. \let\exdent=\internalexdent
  2276. \obeyspaces \obeylines \tt \rawbackslash
  2277. \def\next##1{}\next}
  2278.  
  2279.  
  2280. \let\example=\lisp
  2281. \def\Eexample{\Elisp}
  2282.  
  2283. \let\smallexample=\lisp
  2284. \def\Esmallexample{\Elisp}
  2285.  
  2286. % Macro for 9 pt. examples, necessary to print with 5" lines.
  2287. % From Pavel@xerox.  This is not really used unless the
  2288. % @smallbook command is given.
  2289.  
  2290. \def\smalllispx{\aboveenvbreak\begingroup\inENV
  2291. %            This group ends at the end of the @lisp body
  2292. \hfuzz=12truept % Don't be fussy
  2293. % Make spaces be word-separators rather than space tokens.
  2294. \sepspaces %
  2295. % Single space lines
  2296. \singlespace %
  2297. % The following causes blank lines not to be ignored
  2298. % by adding a space to the end of each line.
  2299. \let\par=\lisppar
  2300. \def\Esmalllisp{\endgroup\afterenvbreak}%
  2301. %%%% Smaller baseline skip for small examples.
  2302. \baselineskip 10pt
  2303. \parskip=0pt
  2304. % @cartouche defines \nonarrowing to inhibit narrowing
  2305. % at next level down.
  2306. \ifx\nonarrowing\relax
  2307. \advance \leftskip by \lispnarrowing
  2308. \let\nonarrowing=\relax
  2309. \fi
  2310. \parindent=0pt
  2311. \let\exdent=\internalexdent
  2312. \obeyspaces \obeylines \ninett \indexfonts \rawbackslash
  2313. \def\next##1{}\next}
  2314.  
  2315. % This is @display; same as @lisp except use roman font.
  2316.  
  2317. \def\display{\begingroup\inENV %This group ends at the end of the @display body
  2318. \aboveenvbreak
  2319. % Make spaces be word-separators rather than space tokens.
  2320. \sepspaces %
  2321. % Single space lines
  2322. \singlespace %
  2323. % The following causes blank lines not to be ignored
  2324. % by adding a space to the end of each line.
  2325. \let\par=\lisppar
  2326. \def\Edisplay{\endgroup\afterenvbreak}%
  2327. \parskip=0pt
  2328. % @cartouche defines \nonarrowing to inhibit narrowing
  2329. % at next level down.
  2330. \ifx\nonarrowing\relax
  2331. \advance \leftskip by \lispnarrowing
  2332. \let\nonarrowing=\relax
  2333. \fi
  2334. \parindent=0pt
  2335. \let\exdent=\internalexdent
  2336. \obeyspaces \obeylines
  2337. \def\next##1{}\next}
  2338.  
  2339. % This is @format; same as @lisp except use roman font and don't narrow margins
  2340.  
  2341. \def\format{\begingroup\inENV %This group ends at the end of the @format body
  2342. \aboveenvbreak
  2343. % Make spaces be word-separators rather than space tokens.
  2344. \sepspaces %
  2345. \singlespace %
  2346. % The following causes blank lines not to be ignored
  2347. % by adding a space to the end of each line.
  2348. \let\par=\lisppar
  2349. \def\Eformat{\endgroup\afterenvbreak}
  2350. \parskip=0pt \parindent=0pt
  2351. \obeyspaces \obeylines
  2352. \def\next##1{}\next}
  2353.  
  2354. % @flushleft and @flushright
  2355.  
  2356. \def\flushleft{%
  2357. \begingroup\inENV %This group ends at the end of the @format body
  2358. \aboveenvbreak
  2359. % Make spaces be word-separators rather than space tokens.
  2360. \sepspaces %
  2361. % The following causes blank lines not to be ignored
  2362. % by adding a space to the end of each line.
  2363. % This also causes @ to work when the directive name
  2364. % is terminated by end of line.
  2365. \let\par=\lisppar
  2366. \def\Eflushleft{\endgroup\afterenvbreak}%
  2367. \parskip=0pt \parindent=0pt
  2368. \obeyspaces \obeylines
  2369. \def\next##1{}\next}
  2370.  
  2371. \def\flushright{%
  2372. \begingroup\inENV %This group ends at the end of the @format body
  2373. \aboveenvbreak
  2374. % Make spaces be word-separators rather than space tokens.
  2375. \sepspaces %
  2376. % The following causes blank lines not to be ignored
  2377. % by adding a space to the end of each line.
  2378. % This also causes @ to work when the directive name
  2379. % is terminated by end of line.
  2380. \let\par=\lisppar
  2381. \def\Eflushright{\endgroup\afterenvbreak}%
  2382. \parskip=0pt \parindent=0pt
  2383. \advance \leftskip by 0pt plus 1fill
  2384. \obeyspaces \obeylines
  2385. \def\next##1{}\next}
  2386.  
  2387. % @quotation - narrow the margins.
  2388.  
  2389. \def\quotation{%
  2390. \begingroup\inENV %This group ends at the end of the @quotation body
  2391. {\parskip=0pt  % because we will skip by \parskip too, later
  2392. \aboveenvbreak}%
  2393. \singlespace
  2394. \parindent=0pt
  2395. \def\Equotation{\par\endgroup\afterenvbreak}%
  2396. % @cartouche defines \nonarrowing to inhibit narrowing
  2397. % at next level down.
  2398. \ifx\nonarrowing\relax
  2399. \advance \leftskip by \lispnarrowing
  2400. \advance \rightskip by \lispnarrowing
  2401. \let\nonarrowing=\relax
  2402. \fi}
  2403.  
  2404. \message{defuns,}
  2405. % Define formatter for defuns
  2406. % First, allow user to change definition object font (\df) internally
  2407. \def\setdeffont #1 {\csname DEF#1\endcsname}
  2408.  
  2409. \newskip\defbodyindent \defbodyindent=.4in
  2410. \newskip\defargsindent \defargsindent=50pt
  2411. \newskip\deftypemargin \deftypemargin=12pt
  2412. \newskip\deflastargmargin \deflastargmargin=18pt
  2413.  
  2414. \newcount\parencount
  2415. % define \functionparens, which makes ( and ) and & do special things.
  2416. % \functionparens affects the group it is contained in.
  2417. \def\activeparens{%
  2418. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  2419. \catcode`\[=\active \catcode`\]=\active}
  2420. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  2421. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  2422. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  2423.  
  2424. % Definitions of (, ) and & used in args for functions.
  2425. % This is the definition of ( outside of all parentheses.
  2426. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  2427. \global\advance\parencount by 1 }
  2428. %
  2429. % This is the definition of ( when already inside a level of parens.
  2430. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  2431. %
  2432. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  2433. % also in that case restore the outer-level definition of (.
  2434. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  2435. \global\advance \parencount by -1 }
  2436. % If we encounter &foo, then turn on ()-hacking afterwards
  2437. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  2438. %
  2439. \gdef\normalparens{\boldbrax\let&=\ampnr}
  2440. } % End of definition inside \activeparens
  2441. %% These parens (in \boldbrax) actually are a little bolder than the
  2442. %% contained text.  This is especially needed for [ and ]
  2443. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  2444. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  2445.  
  2446. % First, defname, which formats the header line itself.
  2447. % #1 should be the function name.
  2448. % #2 should be the type of definition, such as "Function".
  2449.  
  2450. \def\defname #1#2{%
  2451. % Get the values of \leftskip and \rightskip as they were
  2452. % outside the @def...
  2453. \dimen2=\leftskip
  2454. \advance\dimen2 by -\defbodyindent
  2455. \dimen3=\rightskip
  2456. \advance\dimen3 by -\defbodyindent
  2457. \noindent        %
  2458. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  2459. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  2460. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  2461. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  2462. % Now output arg 2 ("Function" or some such)
  2463. % ending at \deftypemargin from the right margin,
  2464. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  2465. {% Adjust \hsize to exclude the ambient margins,
  2466. % so that \rightline will obey them.
  2467. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  2468. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  2469. % Make all lines underfull and no complaints:
  2470. \tolerance=10000 \hbadness=10000    
  2471. \advance\leftskip by -\defbodyindent
  2472. {\df #1}\enskip        % Generate function name
  2473. }
  2474.  
  2475. % Actually process the body of a definition
  2476. % #1 should be the terminating control sequence, such as \Edefun.
  2477. % #2 should be the "another name" control sequence, such as \defunx.
  2478. % #3 should be the control sequence that actually processes the header,
  2479. %    such as \defunheader.
  2480.  
  2481. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2482. \medbreak %
  2483. % Define the end token that this defining construct specifies
  2484. % so that it will exit this group.
  2485. \def#1{\endgraf\endgroup\medbreak}%
  2486. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2487. \parindent=0in
  2488. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2489. \begingroup %
  2490. \catcode 61=\active %
  2491. \obeylines\activeparens\spacesplit#3}
  2492.  
  2493. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2494. \medbreak %
  2495. % Define the end token that this defining construct specifies
  2496. % so that it will exit this group.
  2497. \def#1{\endgraf\endgroup\medbreak}%
  2498. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2499. \parindent=0in
  2500. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2501. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2502.  
  2503. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2504. \medbreak %
  2505. % Define the end token that this defining construct specifies
  2506. % so that it will exit this group.
  2507. \def#1{\endgraf\endgroup\medbreak}%
  2508. \def#2##1 ##2 {\def#4{##1}%
  2509. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2510. \parindent=0in
  2511. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2512. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2513.  
  2514. % These parsing functions are similar to the preceding ones
  2515. % except that they do not make parens into active characters.
  2516. % These are used for "variables" since they have no arguments.
  2517.  
  2518. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2519. \medbreak %
  2520. % Define the end token that this defining construct specifies
  2521. % so that it will exit this group.
  2522. \def#1{\endgraf\endgroup\medbreak}%
  2523. \def#2{\begingroup\obeylines\spacesplit#3}%
  2524. \parindent=0in
  2525. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2526. \begingroup %
  2527. \catcode 61=\active %
  2528. \obeylines\spacesplit#3}
  2529.  
  2530. \def\defvrparsebody #1#2#3#4 {\begingroup\inENV %
  2531. \medbreak %
  2532. % Define the end token that this defining construct specifies
  2533. % so that it will exit this group.
  2534. \def#1{\endgraf\endgroup\medbreak}%
  2535. \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2536. \parindent=0in
  2537. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2538. \begingroup\obeylines\spacesplit{#3{#4}}}
  2539.  
  2540. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  2541. \medbreak %
  2542. % Define the end token that this defining construct specifies
  2543. % so that it will exit this group.
  2544. \def#1{\endgraf\endgroup\medbreak}%
  2545. \def#2##1 ##2 {\def#4{##1}%
  2546. \begingroup\obeylines\spacesplit{#3{##2}}}%
  2547. \parindent=0in
  2548. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2549. \begingroup\obeylines\spacesplit{#3{#5}}}
  2550.  
  2551. % Split up #2 at the first space token.
  2552. % call #1 with two arguments:
  2553. %  the first is all of #2 before the space token,
  2554. %  the second is all of #2 after that space token.
  2555. % If #2 contains no space token, all of it is passed as the first arg
  2556. % and the second is passed as empty.
  2557.  
  2558. {\obeylines
  2559. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2560. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2561. \ifx\relax #3%
  2562. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2563.  
  2564. % So much for the things common to all kinds of definitions.
  2565.  
  2566. % Define @defun.
  2567.  
  2568. % First, define the processing that is wanted for arguments of \defun
  2569. % Use this to expand the args and terminate the paragraph they make up
  2570.  
  2571. \def\defunargs #1{\functionparens \sl
  2572. % Expand, preventing hyphenation at `-' chars.
  2573. % Note that groups don't affect changes in \hyphenchar.
  2574. \hyphenchar\tensl=0
  2575. #1%
  2576. \hyphenchar\tensl=45
  2577. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2578. \interlinepenalty=10000
  2579. \advance\rightskip by 0pt plus 1fil
  2580. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2581. }
  2582.  
  2583. \def\deftypefunargs #1{%
  2584. % Expand, preventing hyphenation at `-' chars.
  2585. % Note that groups don't affect changes in \hyphenchar.
  2586. \functionparens
  2587. \code{#1}%
  2588. \interlinepenalty=10000
  2589. \advance\rightskip by 0pt plus 1fil
  2590. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2591. }
  2592.  
  2593. % Do complete processing of one @defun or @defunx line already parsed.
  2594.  
  2595. % @deffn Command forward-char nchars
  2596.  
  2597. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2598.  
  2599. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2600. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2601. \catcode 61=\other % Turn off change made in \defparsebody
  2602. }
  2603.  
  2604. % @defun == @deffn Function
  2605.  
  2606. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2607.  
  2608. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2609. \begingroup\defname {#1}{Function}%
  2610. \defunargs {#2}\endgroup %
  2611. \catcode 61=\other % Turn off change made in \defparsebody
  2612. }
  2613.  
  2614. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2615.  
  2616. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2617.  
  2618. % #1 is the data type.  #2 is the name and args.
  2619. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2620. % #1 is the data type, #2 the name, #3 the args.
  2621. \def\deftypefunheaderx #1#2 #3\relax{%
  2622. \doind {fn}{\code{#2}}% Make entry in function index
  2623. \begingroup\defname {\code{#1} #2}{Function}%
  2624. \deftypefunargs {#3}\endgroup %
  2625. \catcode 61=\other % Turn off change made in \defparsebody
  2626. }
  2627.  
  2628. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2629.  
  2630. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2631.  
  2632. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2633. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2634. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2635. \def\deftypefnheaderx #1#2#3 #4\relax{%
  2636. \doind {fn}{\code{#3}}% Make entry in function index
  2637. \begingroup\defname {\code{#2} #3}{#1}%
  2638. \deftypefunargs {#4}\endgroup %
  2639. \catcode 61=\other % Turn off change made in \defparsebody
  2640. }
  2641.  
  2642. % @defmac == @deffn Macro
  2643.  
  2644. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2645.  
  2646. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2647. \begingroup\defname {#1}{Macro}%
  2648. \defunargs {#2}\endgroup %
  2649. \catcode 61=\other % Turn off change made in \defparsebody
  2650. }
  2651.  
  2652. % @defspec == @deffn Special Form
  2653.  
  2654. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2655.  
  2656. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2657. \begingroup\defname {#1}{Special Form}%
  2658. \defunargs {#2}\endgroup %
  2659. \catcode 61=\other % Turn off change made in \defparsebody
  2660. }
  2661.  
  2662. % This definition is run if you use @defunx
  2663. % anywhere other than immediately after a @defun or @defunx.
  2664.  
  2665. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2666. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2667. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2668. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2669. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2670. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2671.  
  2672. % @defmethod, and so on
  2673.  
  2674. % @defop {Funny Method} foo-class frobnicate argument
  2675.  
  2676. \def\defop #1 {\def\defoptype{#1}%
  2677. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2678.  
  2679. \def\defopheader #1#2#3{%
  2680. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2681. \begingroup\defname {#2}{\defoptype{} on #1}%
  2682. \defunargs {#3}\endgroup %
  2683. }
  2684.  
  2685. % @defmethod == @defop Method
  2686.  
  2687. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2688.  
  2689. \def\defmethodheader #1#2#3{%
  2690. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2691. \begingroup\defname {#2}{Method on #1}%
  2692. \defunargs {#3}\endgroup %
  2693. }
  2694.  
  2695. % @defcv {Class Option} foo-class foo-flag
  2696.  
  2697. \def\defcv #1 {\def\defcvtype{#1}%
  2698. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2699.  
  2700. \def\defcvarheader #1#2#3{%
  2701. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2702. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2703. \defvarargs {#3}\endgroup %
  2704. }
  2705.  
  2706. % @defivar == @defcv {Instance Variable}
  2707.  
  2708. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  2709.  
  2710. \def\defivarheader #1#2#3{%
  2711. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2712. \begingroup\defname {#2}{Instance Variable of #1}%
  2713. \defvarargs {#3}\endgroup %
  2714. }
  2715.  
  2716. % These definitions are run if you use @defmethodx, etc.,
  2717. % anywhere other than immediately after a @defmethod, etc.
  2718.  
  2719. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2720. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2721. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2722. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2723.  
  2724. % Now @defvar
  2725.  
  2726. % First, define the processing that is wanted for arguments of @defvar.
  2727. % This is actually simple: just print them in roman.
  2728. % This must expand the args and terminate the paragraph they make up
  2729. \def\defvarargs #1{\normalparens #1%
  2730. \interlinepenalty=10000
  2731. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2732.  
  2733. % @defvr Counter foo-count
  2734.  
  2735. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  2736.  
  2737. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2738. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2739.  
  2740. % @defvar == @defvr Variable
  2741.  
  2742. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  2743.  
  2744. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2745. \begingroup\defname {#1}{Variable}%
  2746. \defvarargs {#2}\endgroup %
  2747. }
  2748.  
  2749. % @defopt == @defvr {User Option}
  2750.  
  2751. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  2752.  
  2753. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2754. \begingroup\defname {#1}{User Option}%
  2755. \defvarargs {#2}\endgroup %
  2756. }
  2757.  
  2758. % @deftypevar int foobar
  2759.  
  2760. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2761.  
  2762. % #1 is the data type.  #2 is the name.
  2763. \def\deftypevarheader #1#2{%
  2764. \doind {vr}{\code{#2}}% Make entry in variables index
  2765. \begingroup\defname {\code{#1} #2}{Variable}%
  2766. \interlinepenalty=10000
  2767. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2768. \endgroup}
  2769.  
  2770. % @deftypevr {Global Flag} int enable
  2771.  
  2772. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2773.  
  2774. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2775. \begingroup\defname {\code{#2} #3}{#1}
  2776. \interlinepenalty=10000
  2777. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2778. \endgroup}
  2779.  
  2780. % This definition is run if you use @defvarx
  2781. % anywhere other than immediately after a @defvar or @defvarx.
  2782.  
  2783. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2784. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2785. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2786. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2787. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2788.  
  2789. % Now define @deftp
  2790. % Args are printed in bold, a slight difference from @defvar.
  2791.  
  2792. \def\deftpargs #1{\bf \defvarargs{#1}}
  2793.  
  2794. % @deftp Class window height width ...
  2795.  
  2796. \def\deftp{\defvrparsebody\Edeftp\deftpx\deftpheader}
  2797.  
  2798. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2799. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2800.  
  2801. % This definition is run if you use @deftpx, etc
  2802. % anywhere other than immediately after a @deftp, etc.
  2803.  
  2804. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2805.  
  2806. \message{cross reference,}
  2807. % Define cross-reference macros
  2808. \newwrite \auxfile
  2809.  
  2810. \newif\ifhavexrefs  % True if xref values are known.
  2811. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2812.  
  2813. % \setref{foo} defines a cross-reference point named foo.
  2814.  
  2815. \def\setref#1{%
  2816. %\dosetq{#1-title}{Ytitle}%
  2817. \dosetq{#1-pg}{Ypagenumber}%
  2818. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2819.  
  2820. \def\unnumbsetref#1{%
  2821. %\dosetq{#1-title}{Ytitle}%
  2822. \dosetq{#1-pg}{Ypagenumber}%
  2823. \dosetq{#1-snt}{Ynothing}}
  2824.  
  2825. \def\appendixsetref#1{%
  2826. %\dosetq{#1-title}{Ytitle}%
  2827. \dosetq{#1-pg}{Ypagenumber}%
  2828. \dosetq{#1-snt}{Yappendixletterandtype}}
  2829.  
  2830. % \xref, \pxref, and \ref generate cross-references to specified points.
  2831. % For \xrefX, #1 is the node name, #2 the name of the Info
  2832. % cross-reference, #3 the printed node name, #4 the name of the Info
  2833. % file, #5 the name of the printed manual.  All but the node name can be
  2834. % omitted.
  2835. \def\pxref#1{see \xrefX[#1,,,,,,,]}
  2836. \def\xref#1{See \xrefX[#1,,,,,,,]}
  2837. \def\ref#1{\xrefX[#1,,,,,,,]}
  2838. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
  2839. \def\printedmanual{\ignorespaces #5}%
  2840. \def\printednodename{\ignorespaces #3}%
  2841. %
  2842. \setbox1=\hbox{\printedmanual}%
  2843. \setbox0=\hbox{\printednodename}%
  2844. \ifdim \wd0=0pt%
  2845. \def\printednodename{\ignorespaces #1}%
  2846. %%% Uncommment the following line to make the actual chapter or section title
  2847. %%% appear inside the square brackets.
  2848. %\def\printednodename{#1-title}%
  2849. \fi%
  2850. %
  2851. %
  2852. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
  2853. % not insert empty discretionaries after hyphens, which means that it
  2854. % will not find a line break at a hyphen in a node names.  Since some
  2855. % manuals are best written with fairly long node names, containing
  2856. % hyphens, this is a loss.  Therefore, we simply give the text of
  2857. % the node name again, so it is as if TeX is seeing it for the first
  2858. % time.
  2859. \ifdim \wd1>0pt
  2860. section ``\printednodename'' in \cite{\printedmanual}%
  2861. \else%
  2862. \turnoffactive%
  2863. \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
  2864. \fi
  2865. \endgroup}
  2866.  
  2867. % \dosetq is the interface for calls from other macros
  2868.  
  2869. % Use \turnoffactive so that punctuation chars such as underscore
  2870. % work in node names.
  2871. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  2872. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2873. \next}}
  2874.  
  2875. % \internalsetq {foo}{page} expands into
  2876. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2877. % When the aux file is read, ' is the escape character
  2878.  
  2879. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2880.  
  2881. % Things to be expanded by \internalsetq
  2882.  
  2883. \def\Ypagenumber{\folio}
  2884.  
  2885. \def\Ytitle{\thischapter}
  2886.  
  2887. \def\Ynothing{}
  2888.  
  2889. \def\Ysectionnumberandtype{%
  2890. \ifnum\secno=0 Chapter\xreftie\the\chapno %
  2891. \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
  2892. \else \ifnum \subsubsecno=0 %
  2893. Section\xreftie\the\chapno.\the\secno.\the\subsecno %
  2894. \else %
  2895. Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2896. \fi \fi \fi }
  2897.  
  2898. \def\Yappendixletterandtype{%
  2899. \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
  2900. \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
  2901. \else \ifnum \subsubsecno=0 %
  2902. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2903. \else %
  2904. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2905. \fi \fi \fi }
  2906.  
  2907. \gdef\xreftie{'tie}
  2908.  
  2909. % Use TeX 3.0's \inputlineno to get the line number, for better error
  2910. % messages, but if we're using an old version of TeX, don't do anything.
  2911. \ifx\inputlineno\thisisundefined
  2912.   \let\linenumber = \empty % Non-3.0.
  2913. \else
  2914.   \def\linenumber{\the\inputlineno:\space}
  2915. \fi
  2916.  
  2917. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2918. % If its value is nonempty, SUFFIX is output afterward.
  2919.  
  2920. \def\refx#1#2{%
  2921.   \expandafter\ifx\csname X#1\endcsname\relax
  2922.     % If not defined, say something at least.
  2923.     $\langle$un\-de\-fined$\rangle$%
  2924.     \ifhavexrefs
  2925.       \message{\linenumber Undefined cross reference `#1'.}%
  2926.     \else
  2927.       \ifwarnedxrefs\else
  2928.         \global\warnedxrefstrue
  2929.         \message{Cross reference values unknown; you must run TeX again.}%
  2930.       \fi
  2931.     \fi
  2932.   \else
  2933.     % It's defined, so just use it.
  2934.     \csname X#1\endcsname
  2935.   \fi
  2936.   #2% Output the suffix in any case.
  2937. }
  2938.  
  2939. % Read the last existing aux file, if any.  No error if none exists.
  2940.  
  2941. % This is the macro invoked by entries in the aux file.
  2942. \def\xrdef #1#2{
  2943. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2944.  
  2945. \def\readauxfile{%
  2946. \begingroup
  2947. \catcode `\^^@=\other
  2948. \catcode `\⇧=\other
  2949. \catcode `\⇩=\other
  2950. \catcode `\^^C=\other
  2951. \catcode `\^^D=\other
  2952. \catcode `\^^E=\other
  2953. \catcode `\^^F=\other
  2954. \catcode `\^^G=\other
  2955. \catcode `\^^H=\other
  2956. \catcode `\♪=\other
  2957. \catcode `\^^L=\other
  2958. \catcode `\=\other
  2959. \catcode `\=\other
  2960. \catcode `\⓪=\other
  2961. \catcode `\①=\other
  2962. \catcode `\②=\other
  2963. \catcode `\③=\other
  2964. \catcode `\④=\other
  2965. \catcode `\⑤=\other
  2966. \catcode `\⑥=\other
  2967. \catcode `\⑦=\other
  2968. \catcode `\⑧=\other
  2969. \catcode `\⑨=\other
  2970. \catcode 26=\other
  2971. \catcode `\^^[=\other
  2972. \catcode `\^^\=\other
  2973. \catcode `\^^]=\other
  2974. \catcode `\^^^=\other
  2975. \catcode `\^^_=\other
  2976. \catcode `\@=\other
  2977. \catcode `\^=\other
  2978. \catcode `\~=\other
  2979. \catcode `\[=\other
  2980. \catcode `\]=\other
  2981. \catcode`\"=\other
  2982. \catcode`\_=\other
  2983. \catcode`\|=\other
  2984. \catcode`\<=\other
  2985. \catcode`\>=\other
  2986. \catcode `\$=\other
  2987. \catcode `\#=\other
  2988. \catcode `\&=\other
  2989. % the aux file uses ' as the escape.
  2990. % Turn off \ as an escape so we do not lose on
  2991. % entries which were dumped with control sequences in their names.
  2992. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  2993. % Reference to such entries still does not work the way one would wish,
  2994. % but at least they do not bomb out when the aux file is read in.
  2995. \catcode `\{=1 \catcode `\}=2
  2996. \catcode `\%=\other
  2997. \catcode `\'=0
  2998. \catcode `\\=\other
  2999. \openin 1 \jobname.aux
  3000. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  3001. \fi
  3002. % Open the new aux file.  Tex will close it automatically at exit.
  3003. \openout \auxfile=\jobname.aux
  3004. \endgroup}
  3005.  
  3006.  
  3007. % Footnotes.
  3008.  
  3009. \newcount \footnoteno
  3010.  
  3011. \def\supereject{\par\penalty -20000\footnoteno =0 }
  3012.  
  3013. % @footnotestyle is meaningful for info output only..
  3014. \let\footnotestyle=\comment
  3015.  
  3016. \let\ptexfootnote=\footnote
  3017.  
  3018. {\catcode `\@=11
  3019. \long\gdef\footnote #1{\global\advance \footnoteno by \@ne
  3020. \unskip
  3021. \edef\thisfootno{$^{\the\footnoteno}$}%
  3022. \let\@sf\empty
  3023. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  3024. \thisfootno\@sf \footnotezzz{#1}}
  3025. % \parsearg\footnotezzz}
  3026.  
  3027. \long\gdef\footnotezzz #1{\insert\footins{
  3028. \interlinepenalty\interfootnotelinepenalty
  3029. \splittopskip\ht\strutbox % top baseline for broken footnotes
  3030. \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  3031. \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  3032. \footstrut\parindent=\defaultparindent\hang\textindent{\thisfootno}#1\strut}}
  3033.  
  3034. }%end \catcode `\@=11
  3035.  
  3036. % End of control word definitions.
  3037.  
  3038. \message{and turning on texinfo input format.}
  3039.  
  3040. \def\openindices{%
  3041.    \newindex{cp}%
  3042.    \newcodeindex{fn}%
  3043.    \newcodeindex{vr}%
  3044.    \newcodeindex{tp}%
  3045.    \newcodeindex{ky}%
  3046.    \newcodeindex{pg}%
  3047. }
  3048.  
  3049. % Set some numeric style parameters, for 8.5 x 11 format.
  3050.  
  3051. %\hsize = 6.5in
  3052. \newdimen\defaultparindent \defaultparindent = 15pt
  3053. \parindent = \defaultparindent
  3054. \parskip 18pt plus 1pt
  3055. \baselineskip 15pt
  3056. \advance\topskip by 1.2cm
  3057.  
  3058. % Prevent underfull vbox error messages.
  3059. \vbadness=10000
  3060.  
  3061. % Following George Bush, just get rid of widows and orphans.
  3062. \widowpenalty=10000
  3063. \clubpenalty=10000
  3064.  
  3065. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  3066. % using an old version of TeX, don't do anything.  We want the amount of
  3067. % stretch added to depend on the line length, hence the dependence on
  3068. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  3069. \ifx\emergencystretch\thisisundefined \else
  3070.   \emergencystretch = \hsize
  3071.   \divide\emergencystretch by 45
  3072. \fi
  3073.  
  3074. % Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
  3075. \def\smallbook{
  3076. \global\lispnarrowing = 0.3in
  3077. \global\baselineskip 12pt
  3078. \global\parskip 3pt plus 1pt
  3079. \global\hsize = 5in
  3080. \global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
  3081. \global\vsize=7.5in
  3082. \global\tolerance=700
  3083. \global\hfuzz=1pt
  3084. \global\contentsrightmargin=0pt
  3085.  
  3086. \global\pagewidth=\hsize
  3087. \global\pageheight=\vsize
  3088.  
  3089. \global\let\smalllisp=\smalllispx
  3090. \global\let\smallexample=\smalllispx
  3091. \global\def\Esmallexample{\Esmalllisp}
  3092. }
  3093.  
  3094. % Use @afourpaper to print on European A4 paper.
  3095. \def\afourpaper{
  3096. \global\tolerance=700
  3097. \global\hfuzz=1pt
  3098. \global\baselineskip=12pt
  3099. \global\parskip 15pt plus 1pt
  3100.  
  3101. \global\vsize= 53\baselineskip
  3102. \advance\vsize by \topskip
  3103. %\global\hsize=   5.85in     % A4 wide 10pt
  3104. \global\hsize=  6.5in
  3105. \global\outerhsize=\hsize
  3106. \global\advance\outerhsize by 0.5in
  3107. \global\outervsize=\vsize
  3108. \global\advance\outervsize by 0.6in
  3109. \global\doublecolumnhsize=\hsize
  3110. \global\divide\doublecolumnhsize by 2
  3111. \global\advance\doublecolumnhsize by -0.1in
  3112. \global\doublecolumnvsize=\vsize
  3113. \global\multiply\doublecolumnvsize by 2
  3114. \global\advance\doublecolumnvsize by 0.1in
  3115.  
  3116. \global\pagewidth=\hsize
  3117. \global\pageheight=\vsize
  3118. }
  3119.  
  3120. %% For a final copy, take out the rectangles
  3121. %% that mark overfull boxes (in case you have decided
  3122. %% that the text looks ok even though it passes the margin).
  3123. \def\finalout{\overfullrule=0pt}
  3124.  
  3125. % Define macros to output various characters with catcode for normal text.
  3126. \catcode`\"=\other
  3127. \catcode`\~=\other
  3128. \catcode`\^=\other
  3129. \catcode`\_=\other
  3130. \catcode`\|=\other
  3131. \catcode`\<=\other
  3132. \catcode`\>=\other
  3133. \catcode`\+=\other
  3134. \def\normaldoublequote{"}
  3135. \def\normaltilde{~}
  3136. \def\normalcaret{^}
  3137. \def\normalunderscore{_}
  3138. \def\normalverticalbar{|}
  3139. \def\normalless{<}
  3140. \def\normalgreater{>}
  3141. \def\normalplus{+}
  3142.  
  3143. % This macro is used to make a character print one way in ttfont
  3144. % where it can probably just be output, and another way in other fonts,
  3145. % where something hairier probably needs to be done.
  3146. %
  3147. % #1 is what to print if we are indeed using \tt; #2 is what to print
  3148. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  3149. % interword stretch (and shrink), and it is reasonable to expect all
  3150. % typewriter fonts to have this, we can check that font parameter.
  3151. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  3152.  
  3153. % Turn off all special characters except @
  3154. % (and those which the user can use as if they were ordinary).
  3155. % Most of these we simply print from the \tt font, but for some, we can
  3156. % use math or other variants that look better in normal text.
  3157.  
  3158. \catcode`\"=\active
  3159. \def\activedoublequote{{\tt \char '042}}
  3160. \let"=\activedoublequote
  3161. \catcode`\~=\active
  3162. \def~{{\tt \char '176}}
  3163. \chardef\hat=`\^
  3164. \catcode`\^=\active
  3165. \def^{{\tt \hat}}
  3166.  
  3167. \catcode`\_=\active
  3168. \def_{\ifusingtt\normalunderscore\_}
  3169. % Subroutine for the previous macro.
  3170. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  3171.  
  3172. % \lvvmode is equivalent in function to \leavevmode.
  3173. % Using \leavevmode runs into trouble when written out to
  3174. % an index file due to the expansion of \leavevmode into ``\unhbox
  3175. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  3176. % magic tricks with @.
  3177. \def\lvvmode{\vbox to 0pt{}}
  3178.  
  3179. \catcode`\|=\active
  3180. \def|{{\tt \char '174}}
  3181. \chardef \less=`\<
  3182. \catcode`\<=\active
  3183. \def<{{\tt \less}}
  3184. \chardef \gtr=`\>
  3185. \catcode`\>=\active
  3186. \def>{{\tt \gtr}}
  3187. \catcode`\+=\active
  3188. \def+{{\tt \char 43}}
  3189. %\catcode 27=\active
  3190. %\def^^[{$\diamondsuit$}
  3191.  
  3192. % Used sometimes to turn off (effectively) the active characters
  3193. % even after parsing them.
  3194. \def\turnoffactive{\let"=\normaldoublequote
  3195. \let~=\normaltilde
  3196. \let^=\normalcaret
  3197. \let_=\normalunderscore
  3198. \let|=\normalverticalbar
  3199. \let<=\normalless
  3200. \let>=\normalgreater
  3201. \let+=\normalplus}
  3202.  
  3203. % Set up an active definition for =, but don't enable it most of the time.
  3204. {\catcode`\==\active
  3205. \global\def={{\tt \char 61}}}
  3206.  
  3207. \catcode`\@=0
  3208.  
  3209. % \rawbackslashxx output one backslash character in current font
  3210. \global\chardef\rawbackslashxx=`\\
  3211. %{\catcode`\\=\other
  3212. %@gdef@rawbackslashxx{\}}
  3213.  
  3214. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  3215. {\catcode`\\=\active
  3216. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  3217.  
  3218. % \normalbackslash outputs one backslash in fixed width font.
  3219. \def\normalbackslash{{\tt\rawbackslashxx}}
  3220.  
  3221. % Say @foo, not \foo, in error messages.
  3222. \escapechar=`\@
  3223.  
  3224. % \catcode 17=0   % Define control-q
  3225. \catcode`\\=\active
  3226.  
  3227. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  3228. % That is what \eatinput is for; after that, the `\' should revert to printing 
  3229. % a backslash.
  3230. %
  3231. @gdef@eatinput input texinfo{@fixbackslash}
  3232. @global@let\ = @eatinput
  3233.  
  3234. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  3235. % the first `\{ in the file would cause an error. This macro tries to fix 
  3236. % that, assuming it is called before the first `\' could plausibly occur.
  3237. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  3238.  
  3239. %% These look ok in all fonts, so just make them not special.  The @rm below
  3240. %% makes sure that the current font starts out as the newly loaded cmr10
  3241. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  3242.  
  3243. @textfonts
  3244. @rm
  3245.  
  3246. @c Local variables:
  3247. @c page-delimiter: "^\\\\message"
  3248. @c End:
  3249.